DataFrame
A DataFrame is a 2D table of data with labeled rows and columns, provided by the pandas library. It is the most common way to load, clean, and explore datasets in Python.
Data & AI
Think of a DataFrame as a programmable spreadsheet: each column has a name and a data type, and you can filter rows, compute new columns, group, and summarize with concise code. It's the workhorse of data analysis and the usual starting point before feeding data to a model.
DataFrames make tasks like 'show the average price by city' or 'drop rows with missing values' a one-liner.
Examples
Python
import pandas as pd
df = pd.DataFrame({"city": ["NY", "LA"], "pop": [8.4, 3.9]})
print(df[df["pop"] > 5]["city"].values)Output:
['NY']