info()

noun

say it: “IN-foh” /ˈɪnfoʊ/

A pandas method that prints a short summary of a table: its number of rows and, for each column, its type and how many values are filled in.

What does info() do in pandas?

info() prints a summary of a DataFrame: how many rows it has, and for every column its name, how many values are there (non-null) and its dtype. A column with fewer values than the table has rows has gaps, and a number column read as str needs cleaning.

import pandas as pd
sales = pd.read_csv("sales.csv")
sales.info()       # units: 1888 non-null of 1900 rows, so 12 are missing

In a sentence

  • “info() showed that the units column had 12 values missing.”
  • “He ran info() to see which columns pandas had read as text.”

Level: Apprentice · More Python terms at this level

Updated