Tag: NumPy
np.array() : Create Numpy Array from list, tuple or list of lists in Python
In this article we will discuss how to create a Numpy Array from a sequence like list or tuple etc. Also, how to create a 2D numpy Numpy Array from nested sequence like lists of lists. np.array() – Creating 1D / 2D Numpy Arrays from lists & tuples in Python To install the python’s numpy module …
np.array() : Create Numpy Array from list, tuple or list of lists in PythonRead More
Select Subarray By Index from NumPy Array
In this article we will discuss how to select an element or a sub array from a Numpy Array by index. Let’s create a Numpy Array using numpy.arange() Advertisements # Create a numpy ndArray npArray = np.arange(1, 20, 2) print(npArray) Contents of the Numpy Array is as follows, [ 1 3 5 7 9 11 …
NumPy – Select Rows / Columns By Index
In this article we will discuss how to select elements from a 2D Numpy Array . Elements to select can be a an element only or single/multiple rows & columns or an another sub 2D array. First of all, let’s import numpy module i.e. Advertisements import numpy as np Now let’s create a 2d Numpy …
NumPy – Select Elements By Condition
In this article we will discuss how to select elements or indices from a Numpy array based on multiple conditions. Similar to arithmetic operations when we apply any comparison operator to Numpy Array, then it will be applied to each element in the array and a new bool Numpy Array will be created with values …
numpy.arange() : Create a Numpy Array of evenly spaced numbers in Python
In this article we will discuss how to create a Numpy array of evenly spaced numbers over a given interval using numpy.arrange(). numpy.arrange() Python’s numpy module provides a function to create an Numpy Array of evenly space elements within a given interval i.e. numpy.arange([start, ]stop, [step, ]dtype=None) Arguments: Advertisements start : It’s the start value …
numpy.arange() : Create a Numpy Array of evenly spaced numbers in PythonRead More
Find max value & its index in Numpy Array | numpy.amax()
In this article we will discuss how to get the maximum / largest value in a Numpy array and its indices using numpy.amax(). numpy.amax() Python’s numpy module provides a function to get the maximum value from a Numpy array i.e. Advertisements numpy.amax(a, axis=None, out=None, keepdims=<no value>, initial=<no value>) Arguments : a : numpy array from …
Find max value & its index in Numpy Array | numpy.amax()Read More
Python : Find unique values in a numpy array with frequency & indices | numpy.unique()
In this article we will discuss how to find unique values / rows / columns in a 1D & 2D Numpy array. Also how to find their index position & frequency count using numpy.unique(). numpy.unique() Python’s numpy module provides a function to find the unique elements in a numpy array i.e. Advertisements numpy.unique(ar, return_index=False, return_inverse=False, return_counts=False, …
Python : Find unique values in a numpy array with frequency & indices | numpy.unique()Read More
Create a 1D / 2D Numpy Arrays of zeros or ones
In this article we will discuss how to create a Numpy array of different shapes and initialized with 0 & 1. numpy.zeros() Python’s Numpy module provides a function to create a numpy array of given shape & type and all values in it initialized with 0’s i.e. numpy.zeros(shape, dtype=float, order=’C’) Arguments: Advertisements shape : Shape …
Create Numpy Array of different shapes & initialize with identical values using numpy.full() in Python
In this article we will discuss how to create a Numpy Array of different shapes and initialized with same identical values using numpy.full(). numpy.full() Python’s Numpy module provides a function to create a numpy array of given shape and all elements initialized with a given value, Advertisements numpy.full(shape, fill_value, dtype=None, order=’C’) Arguments:shape: Shape of the …
numpy.amin() | Find minimum value in Numpy Array and it’s index
In this article we will discuss how to find the minimum or smallest value in a Numpy array and it’s indices using numpy.amin(). numpy.amin() Python’s numpy module provides a function to get the minimum value from a Numpy array i.e. Advertisements numpy.amin(a, axis=None, out=None, keepdims=<no value>, initial=<no value>) Arguments : a : numpy array from …
numpy.amin() | Find minimum value in Numpy Array and it’s indexRead More