🎓 A1Learner
🔍
0 of 50 lessons completed

Info: A Full Health Check

The info method gives a full health check of a table. It lists every column, its kind of value, and how many values are filled in.

Info on a tiny table

This table has two columns and three rows. Every value is filled in, so each count is 3.

import pandas as pd

df = pd.DataFrame({
    "product": ["Tea", "Coffee", "Mug"],
    "units": [2, 1, 3],
})
df.info()

One empty slot

This table has an empty slot in the units column. The count for units drops to 2, while product stays at 3.

import pandas as pd

df = pd.DataFrame({
    "product": ["Tea", "Coffee", "Mug"],
    "units": [2, None, 3],
})
df.info()

Example

import io
import pandas as pd

SALES_CSV = """order_id,date,product,category,units,price,region
101,2026-01-05,Tea,Drink,2,4.50,North
102,2026-01-06,Coffee,Drink,1,6.00,South
103,2026-01-07,Mug,Home,3,12.00,East
104,2026-01-08,Notebook,Office,2,8.50,West
105,2026-01-09,Pen,Office,5,2.00,North
106,2026-01-12,Lamp,Home,1,24.00,South
107,2026-01-13,Tea,Drink,4,4.50,East
108,2026-01-14,Coffee,Drink,2,6.00,West
109,2026-01-15,Mug,Home,1,12.00,North
110,2026-01-16,Notebook,Office,3,8.50,South
111,2026-01-19,Pen,Office,2,2.00,East
112,2026-01-20,Lamp,Home,2,24.00,West"""

sales = pd.read_csv(io.StringIO(SALES_CSV))
sales.info()

Key points

  • Use df.info() for a health check of the whole table.
  • Info lists each column name in order.
  • Info shows the kind of value in each column.
  • A null value is an empty slot in a column.
  • Non-Null Count tells how many values are filled in.
  • Info also shows the row count and the memory size.

In this example, the sales CSV is read into a DataFrame named sales. The info call prints the health check on its own. It lists seven columns, and every count is 12, so no value is missing. The last lines give the dtypes and the memory size.

Note

Info prints its report itself, so call it on its own line without print.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Python Playground

Exercise

What does df.info() show?