Examples
import numpy as np
import pandas as pd
dtypes = ['int64', 'float64', 'complex128', 'object', 'bool']
data = dict([(t, np.ones(shape=3000).astype(t))
for t in dtypes])
df = pd.DataFrame(data)
df.head()
df.memory_usage()
df.memory_usage(index=False)
The memory footprint of object dtype columns is ignored by default:
df.memory_usage(deep=True)
Use a Categorical for efficient storage of an object-dtype column with many repeated values.
df['object'].astype('category').memory_usage(deep=True)