Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Series.memory_usage#

Series.memory_usage(index=True,deep=False)[source]#

Return the memory usage of the Series.

The memory usage can optionally include the contribution ofthe index and of elements ofobject dtype.

Parameters:
indexbool, default True

Specifies whether to include the memory usage of the Series index.

deepbool, default False

If True, introspect the data deeply by interrogatingobject dtypes for system-level memory consumption, and includeit in the returned value.

Returns:
int

Bytes of memory consumed.

See also

numpy.ndarray.nbytes

Total bytes consumed by the elements of the array.

DataFrame.memory_usage

Bytes consumed by a DataFrame.

Examples

>>>s=pd.Series(range(3))>>>s.memory_usage()152

Not including the index gives the size of the rest of the data, whichis necessarily smaller:

>>>s.memory_usage(index=False)24

The memory footprint ofobject values is ignored by default:

>>>s=pd.Series(["a","b"])>>>s.valuesarray(['a', 'b'], dtype=object)>>>s.memory_usage()144>>>s.memory_usage(deep=True)244

[8]ページ先頭

©2009-2025 Movatter.jp