info() (Pandas)

df.info() prints a concise technical summary of a DataFrame: the row count, each column's name, its non-null count, its dtype, and the total memory usage. It is the go-to first look at an unfamiliar dataset.

Pandas

Where head() shows you values, info() shows you structure. The non-null count next to each column instantly reveals which columns have missing data and how much, which guides your cleaning before you do any analysis.

The dtype column tells you whether numbers were read as numbers or accidentally as text, and the memory-usage line at the bottom matters when datasets get large. Pass memory_usage='deep' to get the true memory cost of str columns rather than just the pointer overhead.

info() prints its output and returns None, so it is meant for interactive inspection rather than for capturing values in code.

Syntax

df.info(verbose=None, memory_usage=None, show_counts=None)

Examples

Python

import pandas as pd
df = pd.DataFrame({"a": [1, 2], "b": ["x", "y"]})
df.info()

Output:

<class 'pandas.DataFrame'>
RangeIndex: 2 entries, 0 to 1
Data columns (total 2 columns):
 #   Column  Non-Null Count  Dtype
---  ------  --------------  -----
 0   a       2 non-null      int64
 1   b       2 non-null      str  
dtypes: int64(1), str(1)

Learn it in a lesson

See also

Back to the Dictionary