 ## 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

NumPy Introduction

Installing NumPy with pip

Installing NumPy with PyCharm

How to create NumPy arrays

• Create an array using the array() by passing the tuple
• Create an array using the array() by passing the list

Dimensions in Arrays

• Create a Zero-Dimensional NumPy array
• Create a One-Dimensional NumPy array
• Check how many dimensions the array has

Initialize NumPy array

• 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

Array Slicing

• Syntax
• Slicing Examples
• STEP – array slicing
• Slicing 2D arrays with step

Datatypes in NumPy

• 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

Shape of a NumPy array

• Checking the shape of a 1d NumPy array
• Checking the shape of a 2d array

Rehape a NumPy array

• Why reshape?
• Example1: Reshape dimensions from One-Dimensional to Two-Dimensional
• Example 2: Convert 3D Array to 1D array (Flattening the array)

How to Iterate NumPy Arrays?

• Iteration on One-Dimensional NumPy array
• Iteration on Two-Dimensional NumPy array
• Iteration on Three-Dimensional NumPy array

Joining NumPy Arrays

• Concatenate – Joining NumPy Arrays
• Stack – Joining NumPy Arrays

Split NumPy Array

• Split 1D array
• Access split 1D array
• Split 2D array

Search a NumPy Array for a value

Sorting NumPy Arrays

• Sorting a 1D NumPy Integer Array
• Sorting a 1D NumPy strings Array
• Sorting a 2D array

Axes in NumPy Arrays

• Getting minimum value with axes

Intersection of Arrays

• Find the intersection between two arrays
• Find the intersection also sorts the resultant array
• Find the intersection between two arrays with different elements

Difference between Arrays

• Syntax
• Find the difference between 2 arrays
• Finding the difference between two arrays (n2 -n1)

Arithmetic Operations on 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

Random module

• Generate Random numbers
• Generate a random array with a fixed size
• Generate one of the random values based on an array of values

NumPy Logs

• Log: Base 2
• Log: Base 10

NumPy LCM and HCF

• HCF/ GCD of two numbers in NumPy [email protected]

We work to create programming tutorials for all.