Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

Pandas DataFrame: memory_usage() function

DataFrame - memory_usage() function

The memory_usage function is used to get the memory usage of each column in bytes.

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

This value is displayed in DataFrame.info by default. This can be suppressed by setting pandas.options.display.memory_usage to False.

Syntax:

DataFrame.memory_usage(self, index=True, deep=False)

Parameters:

Name Description Type/Default Value Required / Optional
index  Specifies whether to include the memory usage of the DataFrame’s index in returned Series. If index=True, the memory usage of the index is the first item in the output. bool
Default Value: True
Required
deep  If True, introspect the data deeply by interrogating object dtypes for system-level memory consumption, and include it in the returned values. bool
Default Value: False
Required

Returns: Series
A Series whose index is the original column names and whose values is the memory usage of each column in bytes.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - shape property
Next: DataFrame - empty property