Skip to content

Pandas & Plotting

DataFrames: The Universal Table

8 min+70 XPStep 1/10

Every dataset becomes a DataFrame

A DataFrame is a table: rows are examples, named columns are features. Build one from a dict of lists:

  • df = pd.DataFrame({'model': ['a', 'b'], 'acc': [0.9, 0.7]})

Then run the universal first-contact ritual:

  • df.head() — the first 5 rows
  • df.shape — (rows, columns)
  • df.info() — dtypes and non-null counts per column
  • df.describe() — count, mean, std, min, quartiles, max for every numeric column

Ninety percent of exploratory analysis is those four calls plus curiosity. df.info() alone catches half of all data problems — a numeric column reading object means something inside isn't a number.