2. Frequently Asked Questions (FAQ)
Frequently Asked Questions (FAQ)
DataFrame memory usage
As of pandas version 0.15.0, the memory usage of a dataframe (including the index) is shown when accessing the info
method of a dataframe. A configuration option, display.memory_usage
(see Options and Settings), specifies if the dataframe’s memory usage will be displayed when invoking the df.info()
method.
For example, the memory usage of the dataframe below is shown when calling df.info()
:
In [1]: dtypes = ['int64', 'float64', 'datetime64[ns]', 'timedelta64[ns]', ...: 'complex128', 'object', 'bool'] ...: In [2]: n = 5000 In [3]: data = dict([ (t, np.random.randint(100, size=n).astype(t)) ...: for t in dtypes]) ...: In [4]: df = pd.