NumPy
NumPy
NumPy, which stands for Numerical Python, is an open-source Python library consisting of
multidimensional and single-dimensional array elements. It's a standard that computes numerical data in
Python. NumPy is most widely used in almost every domain where numerical computation is required,
like science and engineering; hence, the NumPy API functionalities are highly utilized in data science
and scientific Python packages, including Pandas, SciPy, Matplotlib, scikit-learn, scikit-image, and many
more.
• NumPy includes a wide range of mathematical functions for basic arithmetic, linear algebra, Fourier
analysis, and more.
• NumPy performs numerical operations on large datasets efficiently.
• NumPy supports multi-dimensional arrays, allowing for the representation of complex data
structures such as images, sound waves, and tensors in machine learning models.
• It supports the writing of concise and readable code for complex mathematical computations.
• NumPy integrates with other libraries to do scientific computation; these are SciPy (for scientific
computing), Pandas (for data manipulation and analysis), and scikit-learn (for machine learning).
• Many scientific and numerical computing libraries and tools are built on top of NumPy.
• Its widespread adoption and stability make it a standard choice for numerical computing tasks.
• Data Analysis
• Machine Learning and Artificial Intelligence
• Scientific Computing
• Array manipulation
• Finance and Economics
• Engineering and Robotics
• Image and Signal Processing
• Data Visualisation
NumPy Datatypes
https://www.javatpoint.com/numpy-datatypes
# Array
1. An array is defined as a collection of items that are stored at contiguous memory location.
2. It is a container which can hold a fixed number of items, and these items should be of the same
type.
3. A combination of arrays saves a lot of time. The array can reduce the overall size of the code.
o randn():The function is used to generate a random value close to zero. This may return positive or
negative numbers as well.
EX- ar_randn = np.random.randn(4,2)
print(ar_randn)
o ranf():The function for doing random sampling in numpy. It returns an array of specified shape and
fills it with random floats in the half-open interval[0.0,1.0).
EX- ar_ranf = np.random.ranf(4)
print(ar_ranf)
Broadcasting
https://numpy.org/doc/stable/user/basics.broadcasting.html
Indexing
https://www.w3schools.com/python/numpy/numpy_array_slicing.asp
Slicing
https://www.geeksforgeeks.org/numpy-slicing-and-indexing/
Iteration in Array
https://www.w3schools.com/python/numpy/numpy_array_iterating.asp
Copy v/s View
https://www.w3schools.com/python/numpy/numpy_copy_vs_view.asp
Joining Array
https://www.w3schools.com/python/numpy/numpy_array_join.asp
Split Array
https://www.w3schools.com/python/numpy/numpy_array_split.asp
Search Array
https://www.w3schools.com/python/numpy/numpy_array_search.asp
Sort Array
https://www.w3schools.com/python/numpy/numpy_array_sort.asp
Filter Array
https://www.w3schools.com/python/numpy/numpy_array_filter.asp
Shuffle
https://www.geeksforgeeks.org/numpy-random-shuffle-in-python/
Unique
https://www.geeksforgeeks.org/python-numpy-np-unique-method/
Resize
https://www.geeksforgeeks.org/python-numpy-numpy-resize/
Flatten
https://www.geeksforgeeks.org/numpy-ndarray-flatten-function-python/
Ravel
https://www.geeksforgeeks.org/numpy-ravel-python/
Insert
https://www.geeksforgeeks.org/numpy-insert-python/
Append
https://www.geeksforgeeks.org/numpy-append-python/
Delete
https://www.geeksforgeeks.org/numpy-delete-python/
Matrix in Array
https://www.geeksforgeeks.org/numpy-matrix-python/
Arithmetic Operation in Matrix
https://www.w3schools.com/python/numpy/numpy_ufunc_simple_arithmetic.asp
Functions
▪ Transpose
https://www.geeksforgeeks.org/python-numpy-matrix-transpose/
▪ Swapaxis
https://www.geeksforgeeks.org/numpy-swapaxes-function-python/
▪ Inverse
https://www.geeksforgeeks.org/how-to-inverse-a-matrix-using-numpy/
▪ Power
https://www.geeksforgeeks.org/raise-a-square-matrix-to-the-power-n-in-linear-algebra-
using-numpy-in-python/
▪ Determinate
https://www.geeksforgeeks.org/how-to-calculate-the-determinant-of-a-matrix-using-numpy/