Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


How to obtain a concise summary of a DataFrame in Pandas

Onyejiaku Theophilus Chidalu


We use the info() function in the Pandas.DataFrame module to obtain a concise summary of a given DataFrame.


The info() function takes the syntax shown below:, buf=None, max_cols=None, memory_usage=None, show_counts=None)
Syntax for the info() function


The info() function takes the following optional parameter values:

  • verbose (optional): This parameter takes a Boolean value to indicate whether to print the full summary or not.
  • buf (optional): This is a writable buffer to show where to send the output.
  • memory_usage (optional): This takes a Boolean value indicating whether the total memory usage of the input DataFrame is to be displayed or not.
  • show_counts (optional): This takes a Boolean value indicating whether or not to show non-null counts.

Return value

The info() function returns a summary of the DataFrame.


Let's view the code example as shown below:

# A code to illustrate the info() function of a DataFrame object

import pandas as pd

# creating a list of objects
int_values = [1, 2, 3, 4, 5]
text_values = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']
float_values = [0.0, 0.25, 0.5, 0.75, 1.0]

# creating a dataframe from the list of objects
df = pd.DataFrame({"int_column": int_values, "text_column": text_values,
                  "float_col": float_values})

# getting the summary of the datafrane 
a =

Implementing the info() function


  • Line 3: We import the pandas library.
  • Line 6–8: We create a list of objects, text_values, int_values, and float_values.
  • Line 11–12: We create a DataFrame using the list of objects we created by using pandas.DataFrame(). The name of the DataFrame is df.
  • Line 15: We obtain the summary of the DataFrame object. We assign the result to a variable, a.
  • Line 17: We print the value of a.




Onyejiaku Theophilus Chidalu

View all Courses

Keep Exploring