Python | Numpy.dsplit() method Last Updated : 17 Sep, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report With the help of Numpy.dsplit()() method, we can get the splitted dimensions of an array by using Numpy.dsplit()() method. Syntax : Numpy.dsplit(numpy.array(), split_size) Return : Return the array having splitted dimensions. Example #1 : In this example we can see that using Numpy.expand_dims() method, we are able to get the splitted dimensions using this method. Python3 1=1 # import numpy import numpy as np # using Numpy.dsplit() method gfg = np.array([[1, 2, 5], [3, 4, 10], [5, 6, 15], [7, 8, 20]]) gfg = gfg.reshape(1, 2, 6) print(gfg) gfg = np.dsplit(gfg, 2) print(gfg) Output : [[[ 1 2 5 3 4 10] [ 5 6 15 7 8 20]]] [array([[[ 1, 2, 5], [ 5, 6, 15]]]), array([[[ 3, 4, 10], [ 7, 8, 20]]])] Example #2 : Python3 1=1 # import numpy import numpy as np # using Numpy.expand_dims() method gfg = np.array([[1, 2], [7, 8], [5, 10]]) gfg = gfg.reshape(1, 2, 3) print(gfg) gfg = np.dsplit(gfg, 3) print(gfg) Output : [[[ 1 2 7] [ 8 5 10]]] [array([[[1], [8]]]), array([[[2], [5]]]), array([[[ 7], [10]]])] Comment More infoAdvertise with us Next Article numpy.loadtxt() in Python J jitender_1998 Follow Improve Article Tags : Python Python-numpy Python numpy-arrayManipulation Practice Tags : python Similar Reads Numpy dstack() method-Python numpy.dstack() stacks arrays depth-wise along the third axis (axis=2). For 1D arrays, it promotes them to (1, N, 1) before stacking. For 2D arrays, it stacks them along axis=2 to form a 3D array. Example: Pythonimport numpy as np a = np.array([1, 2, 3]) b = np.array([4, 5, 6]) res = np.dstack((a, b) 2 min read numpy.load() in Python numpy.load() function return the input array from a disk file with npy extension(.npy). Syntax : numpy.load(file, mmap_mode=None, allow_pickle=True, fix_imports=True, encoding='ASCII') Parameters: file : : file-like object, string, or pathlib.Path.The file to read. File-like objects must support the 2 min read Python | Numpy MaskedArray.__div__ numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__div__ we can divide a particular value that is provided as a parameter in the MaskedArray.__div__() method. Syntax: numpy.MaskedArray.__div__ Return: Di 1 min read numpy.diff() in Python numpy.diff() calculate the n-th discrete difference along the specified axis. It is commonly used to find differences between consecutive elements in a NumPy array, such as in time series or signal data. Example:Pythonimport numpy as np a = np.array([1, 2, 4, 7, 0]) res = np.diff(a) print(res)Output 3 min read numpy.loadtxt() in Python numpy.loadtxt() function is used to load data from a text file and return it as a NumPy array. It is ideal for reading large data sets that are stored in simple text formats, such as CSV files or space-separated files.Example: Basic Usage of numpy.loadtxt() for Reading a Simple Space-Separated FileT 4 min read numpy.nanprod() in Python numpy.nanprod() function computes the product of array elements over a given axis while treating NaN (Not a Number) values as 1 (i.e., ignoring them in the product). Example:Pythonimport numpy as np a = np.array([1.0, 2.0, np.nan, 4.0]) res = np.nanprod(a) print(res)Output8.0 Explanation: np.nanprod 2 min read Like