
- NumPy - Home
- NumPy - Introduction
- NumPy - Environment
- NumPy Arrays
- NumPy - Ndarray Object
- NumPy - Data Types
- NumPy Creating and Manipulating Arrays
- NumPy - Array Creation Routines
- NumPy - Array Manipulation
- NumPy - Array from Existing Data
- NumPy - Array From Numerical Ranges
- NumPy - Iterating Over Array
- NumPy - Reshaping Arrays
- NumPy - Concatenating Arrays
- NumPy - Stacking Arrays
- NumPy - Splitting Arrays
- NumPy - Flattening Arrays
- NumPy - Transposing Arrays
- NumPy Indexing & Slicing
- NumPy - Indexing & Slicing
- NumPy - Indexing
- NumPy - Slicing
- NumPy - Advanced Indexing
- NumPy - Fancy Indexing
- NumPy - Field Access
- NumPy - Slicing with Boolean Arrays
- NumPy Array Attributes & Operations
- NumPy - Array Attributes
- NumPy - Array Shape
- NumPy - Array Size
- NumPy - Array Strides
- NumPy - Array Itemsize
- NumPy - Broadcasting
- NumPy - Arithmetic Operations
- NumPy - Array Addition
- NumPy - Array Subtraction
- NumPy - Array Multiplication
- NumPy - Array Division
- NumPy Advanced Array Operations
- NumPy - Swapping Axes of Arrays
- NumPy - Byte Swapping
- NumPy - Copies & Views
- NumPy - Element-wise Array Comparisons
- NumPy - Filtering Arrays
- NumPy - Joining Arrays
- NumPy - Sort, Search & Counting Functions
- NumPy - Searching Arrays
- NumPy - Union of Arrays
- NumPy - Finding Unique Rows
- NumPy - Creating Datetime Arrays
- NumPy - Binary Operators
- NumPy - String Functions
- NumPy - Matrix Library
- NumPy - Linear Algebra
- NumPy - Matplotlib
- NumPy - Histogram Using Matplotlib
- NumPy Sorting and Advanced Manipulation
- NumPy - Sorting Arrays
- NumPy - Sorting along an axis
- NumPy - Sorting with Fancy Indexing
- NumPy - Structured Arrays
- NumPy - Creating Structured Arrays
- NumPy - Manipulating Structured Arrays
- NumPy - Record Arrays
- Numpy - Loading Arrays
- Numpy - Saving Arrays
- NumPy - Append Values to an Array
- NumPy - Swap Columns of Array
- NumPy - Insert Axes to an Array
- NumPy Handling Missing Data
- NumPy - Handling Missing Data
- NumPy - Identifying Missing Values
- NumPy - Removing Missing Data
- NumPy - Imputing Missing Data
- NumPy Performance Optimization
- NumPy - Performance Optimization with Arrays
- NumPy - Vectorization with Arrays
- NumPy - Memory Layout of Arrays
- Numpy Linear Algebra
- NumPy - Linear Algebra
- NumPy - Matrix Library
- NumPy - Matrix Addition
- NumPy - Matrix Subtraction
- NumPy - Matrix Multiplication
- NumPy - Element-wise Matrix Operations
- NumPy - Dot Product
- NumPy - Matrix Inversion
- NumPy - Determinant Calculation
- NumPy - Eigenvalues
- NumPy - Eigenvectors
- NumPy - Singular Value Decomposition
- NumPy - Solving Linear Equations
- NumPy - Matrix Norms
- NumPy Element-wise Matrix Operations
- NumPy - Sum
- NumPy - Mean
- NumPy - Median
- NumPy - Min
- NumPy - Max
- NumPy Set Operations
- NumPy - Unique Elements
- NumPy - Intersection
- NumPy - Union
- NumPy - Difference
- NumPy Random Number Generation
- NumPy - Random Generator
- NumPy - Permutations & Shuffling
- NumPy - Uniform distribution
- NumPy - Normal distribution
- NumPy - Binomial distribution
- NumPy - Poisson distribution
- NumPy - Exponential distribution
- NumPy - Rayleigh Distribution
- NumPy - Logistic Distribution
- NumPy - Pareto Distribution
- NumPy - Visualize Distributions With Sea born
- NumPy - Matplotlib
- NumPy - Multinomial Distribution
- NumPy - Chi Square Distribution
- NumPy - Zipf Distribution
- NumPy File Input & Output
- NumPy - I/O with NumPy
- NumPy - Reading Data from Files
- NumPy - Writing Data to Files
- NumPy - File Formats Supported
- NumPy Mathematical Functions
- NumPy - Mathematical Functions
- NumPy - Trigonometric functions
- NumPy - Exponential Functions
- NumPy - Logarithmic Functions
- NumPy - Hyperbolic functions
- NumPy - Rounding functions
- NumPy Fourier Transforms
- NumPy - Discrete Fourier Transform (DFT)
- NumPy - Fast Fourier Transform (FFT)
- NumPy - Inverse Fourier Transform
- NumPy - Fourier Series and Transforms
- NumPy - Signal Processing Applications
- NumPy - Convolution
- NumPy Polynomials
- NumPy - Polynomial Representation
- NumPy - Polynomial Operations
- NumPy - Finding Roots of Polynomials
- NumPy - Evaluating Polynomials
- NumPy Statistics
- NumPy - Statistical Functions
- NumPy - Descriptive Statistics
- NumPy Datetime
- NumPy - Basics of Date and Time
- NumPy - Representing Date & Time
- NumPy - Date & Time Arithmetic
- NumPy - Indexing with Datetime
- NumPy - Time Zone Handling
- NumPy - Time Series Analysis
- NumPy - Working with Time Deltas
- NumPy - Handling Leap Seconds
- NumPy - Vectorized Operations with Datetimes
- NumPy ufunc
- NumPy - ufunc Introduction
- NumPy - Creating Universal Functions (ufunc)
- NumPy - Arithmetic Universal Function (ufunc)
- NumPy - Rounding Decimal ufunc
- NumPy - Logarithmic Universal Function (ufunc)
- NumPy - Summation Universal Function (ufunc)
- NumPy - Product Universal Function (ufunc)
- NumPy - Difference Universal Function (ufunc)
- NumPy - Finding LCM with ufunc
- NumPy - ufunc Finding GCD
- NumPy - ufunc Trigonometric
- NumPy - Hyperbolic ufunc
- NumPy - Set Operations ufunc
- NumPy Useful Resources
- NumPy - Quick Guide
- NumPy - Cheatsheet
- NumPy - Useful Resources
- NumPy - Discussion
- NumPy Compiler
NumPy - Array Manipulation
Several routines are available in NumPy package for manipulation of elements in ndarray object. They can be classified into the following types −
Changing Shape
In NumPy, to change shape is to alter the shape of arrays without changing their data −
Sr.No. | Shape & Description |
---|---|
1 |
reshape()
Gives a new shape to an array without changing its data |
2 |
flat()
A 1-D iterator over the array |
3 |
flatten()
Returns a copy of the array collapsed into one dimension |
4 |
ravel()
Returns a contiguous flattened array |
5 |
pad()
Returns a padded array with shape increased according to pad_width |
Transpose Operations
The NumPy transpose operations swap rows and columns in 2D arrays or rearrange axes in higher-dimensional arrays −
Sr.No. | Operation & Description |
---|---|
1 |
transpose
Permutes the dimensions of an array |
2 |
ndarray.T
Same as self.transpose() |
3 |
rollaxis
Rolls the specified axis backwards |
4 |
swapaxes
Interchanges the two axes of an array |
5 |
moveaxis()
Move axes of an array to new positions |
Changing Dimensions
Changing dimensions of arrays in NumPy involves reshaping or restructuring arrays to fit specific requirements without altering the data −
Sr.No. | Dimension & Description |
---|---|
1 |
broadcast
Produces an object that mimics broadcasting |
2 |
broadcast_to
Broadcasts an array to a new shape |
3 |
expand_dims
Expands the shape of an array |
4 |
squeeze
Removes single-dimensional entries from the shape of an array |
Joining Arrays
Joining arrays in NumPy concatenate multiple arrays along specified axes −
Sr.No. | Array & Description |
---|---|
1 |
concatenate
Joins a sequence of arrays along an existing axis |
2 |
stack
Joins a sequence of arrays along a new axis |
3 |
hstack
Stacks arrays in sequence horizontally (column wise) |
4 |
vstack
Stacks arrays in sequence vertically (row wise) |
5 |
dstack()
Stack arrays in sequence depth wise (along third axis). |
6 |
column_stack()
Stacks arrays in sequence vertically (row wise) |
7 |
row_stack()
Stacks arrays in sequence vertically (row wise) |
Splitting Arrays
Splitting arrays in NumPy splits arrays into smaller arrays along specified axes −
Sr.No. | Array & Description |
---|---|
1 |
split
Splits an array into multiple sub-arrays |
2 |
hsplit
Splits an array into multiple sub-arrays horizontally (column-wise) |
3 |
vsplit
Splits an array into multiple sub-arrays vertically (row-wise) |
4 |
dsplit()
Split array into multiple sub-arrays along the 3rd axis (depth) |
5 |
array_split
Split an array into multiple sub-arrays |
Adding / Removing Elements
Adding or removing elements in NumPy append elements to arrays or remove elements −
Sr.No. | Element & Description |
---|---|
1 |
resize
Returns a new array with the specified shape |
2 |
append
Appends the values to the end of an array |
3 |
insert
Inserts the values along the given axis before the given indices |
4 |
delete
Returns a new array with sub-arrays along an axis deleted |
5 |
unique
Finds the unique elements of an array |
Repeating and Tiling Arrays
In Numpy, Repeating and tiling arrays are techniques used to create larger arrays by duplicating the elements of an existing array in various patterns −
Sr.No. | Array & Description |
---|---|
1 |
repeat()
Repeat each element of an array after themselves |
2 |
tile()
Construct an array by repeating A the number of times given by reps |
Rearranging Elements
In NumPy, elements of an array can be rearranged using various methods to achieve the desired order or structure. Following are the common operations −
Sr.No. | Array & Description |
---|---|
1 |
flip()
Reverse the order of elements in an array along the given axis |
2 |
fliplr()
Reverse the order of elements along axis 1 (left/right) |
3 |
flipud()
Reverse the order of elements along axis 0 (up/down) |
4 |
roll()
Roll array elements along a given axis |
Sorting and Searching
NumPy offers powerful tools for sorting and searching within arrays, enabling efficient data manipulation and analysis −
Sr.No. | Array & Description |
---|---|
1 |
sort()
Return a sorted copy of an array |
2 |
argsort()
Returns the indices that would sort an array |
3 |
lexsort()
Perform an indirect stable sort using a sequence of keys |
4 |
searchsorted()
Find indices where elements should be inserted to maintain order |
5 |
argmax()
Returns the indices of the maximum values along an axis |
6 |
argmin()
Returns the indices of the minimum values along an axis |
7 |
nonzero()
Return the indices of the elements that are non-zero |
8 |
where()
Return elements chosen from x or y depending on condition |
Set Operations
Set operations in NumPy involve performing mathematical set operations on arrays, such as union, intersection, difference, and checking for unique elements. These operations are particularly useful for handling and analyzing distinct values within datasets −
Sr.No. | Array & Description |
---|---|
1 |
in1d()
Test whether each element of a 1-D array is also present in a second array |
2 |
intersect1d()
Find the intersection of two arrays |
3 |
setdiff1d()
Find the set difference of two arrays and returns the unique values in ar1 that are not in ar2 |
4 |
setxor1d()
Find the set exclusive-or of two arrays and returns the sorted, unique values that are in only one (not both) of the input arrays |
5 |
union1d()
Find the union of two arrays and returns the unique, sorted array of values that are in either of the two input arrays. |
Other Arrays Operations
Following are the a=other arryas opertions in Numpy −
Sr.No. | Array & Description |
---|---|
1 |
clip()
Clip (limit) the values in an array. |
2 |
round()
Evenly round to the given number of decimals |
3 |
diagonal()
Return specified diagonals |
4 |
trace()
Return the sum along diagonals of the array |
5 |
take()
Take elements from an array along an axis |
6 |
put()
Replaces specified elements of an array with given values |
7 |
choose()
Construct an array from an index array and a list of arrays to choose from |