numpy.ndarray.itemsize() method | Python Last Updated : 26 Mar, 2020 Comments Improve Suggest changes Like Article Like Report numpy.ndarray.itemsize() function return the length of one array element in bytes. Syntax : numpy.ndarray.itemsize(arr) Parameters : arr : [array_like] Input array. Return : [int] The length of one array element in bytes Code #1 : Python3 # Python program explaining # numpy.ndarray.itemsize() function # importing numpy as geek import numpy as geek arr = geek.array([1, 2, 3, 4], dtype = geek.float64) gfg = arr.itemsize print (gfg) Output : 8 Code #2 : Python3 # Python program explaining # numpy.ndarray.itemsize() function # importing numpy as geek import numpy as geek arr = geek.array([1, 2, 3, 4], dtype = geek.complex128) gfg = arr.itemsize print (gfg) Output : 16 Comment More infoAdvertise with us Next Article numpy.ndarray.itemsize() method | Python sanjoy_62 Follow Improve Article Tags : Machine Learning Python-numpy Python numpy-ndarray python Practice Tags : Machine Learningpython Similar Reads Python | Numpy ndarray.item() With the help of numpy.ndarray.item() method, we can fetch the data elements that is found at the given index on numpy array. Remember we can give index as one dimensional parameter or can be two dimensional. Parameters: *args : Arguments (variable number and type) -> none: This argument only works 2 min read numpy.ndarray.ndim() method | Python numpy.ndarray.ndim() function return the number of dimensions of an array. Syntax : numpy.ndarray.ndim(arr) Parameters : arr : [array_like] Input array. If it is not already an ndarray, a conversion is attempted. Return : [int] Return the number of dimensions in arr. Code #1 : Python3 # Python progr 1 min read Python | Numpy ndarray.__itruediv__() With the help of Numpy ndarray.__itruediv__(), we can divide a particular value that is provided as a parameter in the ndarray.__itruediv__() method. Value will be divided to each and every element in a numpy array. Syntax: ndarray.__itruediv__($self, value, /) Return: self/=value Example #1 : In th 1 min read Numpy ndarray.flatten() function in Python The flatten() function is used to convert a multi-dimensional NumPy array into a one-dimensional array. It creates a new copy of the data so that original array stays unchanged. If your array has rows and columns or even more dimensions, then flatten() line up every single value into a straight list 3 min read numpy.ndarray.resize() function - Python numpy.ndarray.resize() function change shape and size of array in-place. Syntax : numpy.ndarray.resize(new_shape, refcheck = True) Parameters : new_shape :[tuple of ints, or n ints] Shape of resized array. refcheck :[bool, optional] If False, reference count will not be checked. Default is True. Ret 1 min read Numpy ndarray.tobytes() function | Python numpy.ndarray.tobytes() function construct Python bytes containing the raw data bytes in the array. Syntax : numpy.ndarray.tobytes(order='C') Parameters : order : [{âCâ, âFâ, None}, optional] Order of the data for multidimensional arrays: C, Fortran, or the same as for the original array. Return : P 1 min read numpy.asanyarray() in Python numpy.asanyarray()function is used when we want to convert input to an array but it pass ndarray subclasses through. Input can be scalars, lists, lists of tuples, tuples, tuples of tuples, tuples of lists and ndarrays. Syntax : numpy.asanyarray(arr, dtype=None, order=None) Parameters : arr : [array_ 2 min read numpy.asarray() in Python numpy.asarray()function is used when we want to convert input to an array. Input can be lists, lists of tuples, tuples, tuples of tuples, tuples of lists and arrays. Syntax : numpy.asarray(arr, dtype=None, order=None) Parameters : arr : [array_like] Input data, in any form that can be converted to a 2 min read NumPy ndarray nbytes() Method The NumPy ndarray nbytes() function return the total bytes consumed by the elements of the array. NotesIt returns the total bytes consumed by the total element of the array, but it does not calculate memory consumed by non-element attributes of the array object.The size of the data element depends o 1 min read NumPy ndarray itemset() Method | Insert Scalar in ndarray The NumPy ndarray.itemset() method inserts a scalar into an array. Key Points:ndarray.itemset function needs at least one argument.The last argument you pass in the function is considered an "item". arr.itemset(*args) is a quicker way to do same thing as arr[args] = item. The item should be a scalar 2 min read Like