Python | Pandas dataframe.memory_usage() Last Updated : 22 Jun, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.Pandas dataframe.memory_usage() function return 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. Syntax: DataFrame.memory_usage(index=True, deep=False)Parameters : 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 the first item in the output. deep : If True, introspect the data deeply by interrogating object dtypes for system-level memory consumption, and include it in the returned values.Returns : A Series whose index is the original column names and whose values is the memory usage of each column in bytes For link to the CSV file used in the code, click hereExample #1: Use memory_usage() function print the memory usage of each column in the dataframe along with the memory usage of the index. Python3 # importing pandas as pd import pandas as pd # Creating the dataframe df = pd.read_csv("nba.csv") # Print the dataframe df Let's use the memory_usage() function to find the memory usage of each column. Python3 # Function to find memory use of each # column along with the index # even if we do not set index = True, # it will show the index usage as well by default. df.memory_usage(index = True) Output : Example #2: Use memory_usage() function to find the memory use of each column but not of the index. Python3 # importing pandas as pd import pandas as pd # Creating the dataframe df = pd.read_csv("nba.csv") # Function to find memory use of each # column but not of the index # we set index = False df.memory_usage(index = False) Output : Comment More infoAdvertise with us Next Article Python | Pandas DataFrame.values S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python pandas-dataFrame Pandas-DataFrame-Methods +1 More Practice Tags : python Similar Reads Python | Pandas Index.memory_usage() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.memory_usage() function return the memory usage of the Index. It returns 2 min read Python | Pandas DataFrame.empty Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. It can be thought of as a dict-like container for Series objects. This is the primary data structure o 2 min read Python | Pandas DataFrame.values Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. It can be thought of as a dict-like container for Series objects. This is the primary data structure o 2 min read Python | Pandas dataframe.info() When working with data in Python understanding the structure and content of our dataset is important. The dataframe.info() method in Pandas helps us in providing a concise summary of our DataFrame and it quickly assesses its structure, identify issues like missing values and optimize memory usage.Ke 2 min read Memory leak using Pandas DataFrame Pandas is a powerful and widely-used open-source data analysis and manipulation library for Python. It provides a DataFrame object that allows you to store and manipulate tabular data in rows and columns in a very intuitive way. Pandas DataFrames are powerful tools for working with data, but they ca 9 min read Python | Pandas DataFrame.ftypes Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. It can be thought of as a dict-like container for Series objects. This is the primary data structure o 2 min read Like