Pandas DataFrames

A DataFrame is a table — rows and named columns — like a spreadsheet you can code against.

`pd.DataFrame({...})` builds one from columns. `df.shape` gives (rows, cols), `df.columns` lists the names, `df["col"]` selects a column, and `df.head()` peeks at the top rows.

import pandas as pd
df = pd.DataFrame({"size": [80, 120], "price": [300, 450]})
print(df.shape)            # (2, 2)
print(df["price"].mean())  # 375.0

More lessons in Python for data