Featured Post

How to Compare Text in Python

Image
Python like other programming languages supports comparison operators. These primarily use to test the condition in the program. Here's a list of operators that you can use in python programs. Comparison operators List of operators < <= > >= == != Is is not How to use comparison operators Here, I have assigned 23 to a and 11 to b. Then, I did apply all the comparison operators. The output is self-explanatory, and If you are in doubt while programming, remember to visit this page. Examples a = 23 b = 11 print("Is a greater than b?", a > b)           #greater than print("Is a less than b?", a < b)              #less than print("Is a greater or equal to b?", a >= b)   #greater or equal print("Is a less or equal to b?", a <= b)      #less or equal print("Is a equal to b (option 1)?", a == b)         #test for equality print("Is a equal to b (option 2)?", a is b)         #test for equality print("I

Numpy Array Vs. List: What's the Difference

Here are the differences between List and NumPy Array. Both store data, but technically these are not the same. You'll find here where they differ from each other.

Python Lists

Here is all about Python lists:

  • Lists can have data of different data types. For instance, data = [3, 3.2, 4.6, 6, 6.8, 9, “hello”, ‘a’]
  • Operations such as subtraction, multiplying, and division allow doing through loops
  • Storage space required is more, as each element is considered an object in Python
  • Execution time is high for large datasets
  • Lists are inbuilt data types


Array vs list


NumPy Arrays

Here is all about NumPy Arrays:
  • Numpy arrays are containers for storing only homogeneous data types. For example: data= [3.2, 4.6, 6.8]; data=[3, 6, 9]; data=[‘hello’, ‘a’]
  • Numpy is designed to do all mathematical operations in parallel and is also simpler than Python
  • Numpy storage space is very much less compared to the list due to the practice of homogeneous data type
  • Execution time is very less for large datasets
  • Numpy is a third-party library that needs to be installed by Conda or PIP


References

Comments

Popular posts from this blog

7 AWS Interview Questions asked in Infosys, TCS

How to Decode TLV Quickly

Hyperledger Fabric: 20 Real Interview Questions