The info() function helps you quickly see the types of data in each column and how many missing values there are. This helps you understand your data better before analysis.
0
0
info() for column types and nulls in Pandas
Introduction
When you want to check what kind of data each column holds, like numbers or text.
When you want to find out if any columns have missing or empty values.
When you want a quick summary of your dataset's size and structure.
Before cleaning data to know which columns need fixing.
When exploring a new dataset to get a quick overview.
Syntax
Pandas
DataFrame.info(verbose=None, buf=None, max_cols=None, memory_usage=None, show_counts=None)
DataFrame is your data table.
You usually just call info() without extra arguments for a quick summary.
Examples
Shows a summary of the DataFrame including column names, non-null counts, and data types.
Pandas
df.info()
Shows counts of non-null values for each column explicitly (useful in newer pandas versions).
Pandas
df.info(show_counts=True)Sample Program
This code creates a small table with some missing values. Then it uses info() to show the data types and how many values are missing in each column.
Pandas
import pandas as pd data = { 'Name': ['Alice', 'Bob', 'Charlie', None], 'Age': [25, 30, None, 22], 'Salary': [50000, 60000, 55000, None] } df = pd.DataFrame(data) # Use info() to see column types and null counts df.info()
OutputSuccess
Important Notes
The info() output shows non-null counts, which tell you how many values are NOT missing.
Data types like object usually mean text data.
Missing values appear as fewer non-null counts than total rows.
Summary
info() gives a quick look at your data's columns, types, and missing values.
It helps you decide what cleaning or processing your data needs.
Use it early when exploring any new dataset.