Series.memory_usage(self, index=True, deep=False)
[source]
Return the memory usage of the Series.
The memory usage can optionally include the contribution of the index and of elements of object
dtype.
Parameters: |
|
---|---|
Returns: |
|
See also
numpy.ndarray.nbytes
DataFrame.memory_usage
>>> s = pd.Series(range(3)) >>> s.memory_usage() 152
Not including the index gives the size of the rest of the data, which is necessarily smaller:
>>> s.memory_usage(index=False) 24
The memory footprint of object
values is ignored by default:
>>> s = pd.Series(["a", "b"]) >>> s.values array(['a', 'b'], dtype=object) >>> s.memory_usage() 144 >>> s.memory_usage(deep=True) 260
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.memory_usage.html