What information is returned from df.info()?


#1

Question

What information is returned when we run df.info()?

Answer

When using .info() in Pandas, it will return information about the dataframe including the data types of each column and memory usage of the entire data.

To see this better, let’s observe the information being printed out.
First, it will print out the data type of the object, which is a Pandas dataframe.
<class 'pandas.core.frame.DataFrame'>

Next, it will display the number of entries, or rows, in the dataframe, and the range of values of the row indexes. Here the first index is 0 and the last index is 219.
RangeIndex: 220 entries, 0 to 219

After this, it prints out the information regarding each data column, including the column names, number of entries, whether they have non-null values, and the data type.
id 220 non-null int64

After this, it will display overall how many columns there are per datatype in the dataframe.
dtypes: float64(1), int64(2), object(2)

And finally, it shows the memory usage of the dataframe.
memory usage: 8.7+ KB