You can use array.nbytes
for numpy arrays, for example:
>>> import numpy as np
>>> from sys import getsizeof
>>> a = [0] * 1024
>>> b = np.array(a)
>>> getsizeof(a)
8264
>>> b.nbytes
8192
More Related Contents:
- What are the advantages of NumPy over regular Python lists?
- What is the difference between contiguous and non-contiguous arrays?
- Translate every element in numpy array according to key
- Automatically import modules when entering the python or ipython interpreter
- Plotting a fast Fourier transform in Python
- Concatenate Numpy arrays without copying
- Equivalent of Numpy.argsort() in basic python? [duplicate]
- How to create a density plot in matplotlib?
- How to do n-D distance and nearest neighbor calculations on numpy arrays
- Vectorizing Haversine distance calculation in Python
- How to install numpy and scipy for Ironpython27?
- Preserve custom attributes when pickling subclass of numpy array
- Scikit Learn SVC decision_function and predict
- How can I take the square root of -1 using python?
- Performance: Matlab vs Python
- Filtering a list based on a list of booleans
- Input and output numpy arrays to h5py
- Running maximum of numpy array values
- Access n-th dimension in python [duplicate]
- Weird behaviour initializing a numpy array of string data
- Extract csv file specific columns to list in Python
- How to “scale” a numpy array?
- Resample time series in pandas to a weekly interval
- How to convert an image from np.uint16 to np.uint8?
- Python import error: cannot import name ‘six’ from ‘sklearn.externals’
- Passing C++ vector to Numpy through Cython without copying and taking care of memory management automatically
- Numpy Broadcast to perform euclidean distance vectorized
- numpy.sum() giving strange results on large arrays
- ValueError: x and y must be the same size
- Avoid overflow when adding numpy arrays