NumPy for Data Science – Part 1
Naveen
- 0
What is NumPy Array?
An array is a grid of values and it contains information about the raw data, how to locate an element, and how to interpret an element.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-112.png)
Numpy vs Python List
Advantages of using NumPy Arrays over Python List:
- Consumes less memory.
- Fast as compared to the Python List.
- Convenient to use.
Let’s look at the example of NumPy Array and Python List.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-113.png)
Importance of NumPy Array in Python
- Wide verity of mathematical operations on Arrays.
- It supplies an enormous library of high-level mathematical function that operate on these Arrays and metrices.
- Mathematical, logical, shape, manipulation, sorting, selecting, I/O, discrete Fourier transforms, basic linear algebra, basic statistical operations, random simulation and much more.
Creating NumPy Arrays
- To create a NumPy Array, you can use the function np.array().
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-114.png)
Dimensions in Array
- 1-D Arrays
- 2-D Arrays
- 3-D Arrays
- High Dimensional Arrays
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-115.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-116.png)
Special NumPy Arrays
- Array filled with 0’s
- Array files with 1’s
- An Array with a range of elements
- Array diagonal element filled with 1’s
- Create an array with values that are spaced linearly in a specified interval.
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-117.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-118.png)
![](https://www.nomidl.com/wp-content/uploads/2022/10/image-119.png)
Conclusion
In this article we have learned what is NumPy and how to create 1-D, 2-D, 3-D and High dimensional arrays in it, in the next part we will be learning how to create NumPy Arrays with Random Numbers.
NumPy for Data Science – Part 2
Popular Posts
Spread the knowledge