
29 Mar NumPy Tutorial
NumPy is an open-source Python library, that allows you to work with multi-dimensional arrays and matrices, with the mathematical functions operating on these arrays. It stands for Numerical Python and is written in Python and C.
NumPy Tutorial Index
- Create an array using the array() by passing the tuple
- Create an array using the array() by passing the list
- Create a Zero-Dimensional NumPy array
- Create a One-Dimensional NumPy array
- Check how many dimensions the array has
- Initialize NumPy arrays with zeros
Access NumPy array elements (Indexing)
- Access elements from a One-Dimensional array
- Access elements from a Two-Dimensional array
- Access elements from a Three-Dimensional array
- Access an array from the last with Negative Indexing
- Syntax
- Slicing Examples
- STEP – array slicing
- Slicing 2D arrays with step
- Get the data type of a NumPy array with an integer
- Get the data type of a NumPy array with strings
- Set the datatype size within a NumPy array
- Convert one datatype to another
- Checking the shape of a 1d NumPy array
- Checking the shape of a 2d array
- Why reshape?
- Example1: Reshape dimensions from One-Dimensional to Two-Dimensional
- Example 2: Convert 3D Array to 1D array (Flattening the array)
- Iteration on One-Dimensional NumPy array
- Iteration on Two-Dimensional NumPy array
- Iteration on Three-Dimensional NumPy array
- Concatenate – Joining NumPy Arrays
- Stack – Joining NumPy Arrays
- Split 1D array
- Access split 1D array
- Split 2D array
Search a NumPy Array for a value
- Sorting a 1D NumPy Integer Array
- Sorting a 1D NumPy strings Array
- Sorting a 2D array
- Getting minimum value with axes
- Find the intersection between two arrays
- Find the intersection also sorts the resultant array
- Find the intersection between two arrays with different elements
- Syntax
- Find the difference between 2 arrays
- Finding the difference between two arrays (n2 -n1)
Arithmetic Operations on NumPy arrays
- Adding NumPy arrays
- Subtracting NumPy arrays
- Multiply NumPy arrays
- Divide NumPy arrays
Scalar operations on NumPy array
- Adding a value to each element of a NumPy array
- Subtracting a value from each element of a NumPy array
- Multiplying a value to each element of a NumPy array
- Dividing a value from each element of a NumPy array
Math Operations on NumPy array
- Mean
- Median
- Standard Deviation
- Generate Random numbers
- Generate a random array with a fixed size
- Generate one of the random values based on an array of values
- Log: Base 2
- Log: Base 10
- HCF/ GCD of two numbers in NumPy
No Comments