Skip to content

Pas encore disponible en français. Voir tout ce qui existe en français

Stockertim Dictionary · Technology

DataFrame

Also called data frame, pandas DataFrame, DataFrames

In short

A table of data in the pandas library for Python, with labelled rows and named columns that can each hold a different data type.

  • Advanced
  • Technology
  • Checked

In detail

A DataFrame is the main structure analysts use for tabular data in Python. It resembles a spreadsheet tab: each column has a name and a single data type, and each row carries an index label, which for market data is often a date. Different columns can hold different types, so one DataFrame can contain tickers as text, closing prices as decimals, volumes as integers and trading dates as timestamps.

Its strength is acting on whole columns at once rather than cell by cell. One instruction can compute daily returns for every row, filter to a single sector, group by year and total, join two tables on a shared key or reshape a long table into a wide one. Because each step is written as code, the same analysis can be rerun next month on fresh data and checked line by line by a colleague, which is hard to do with manual spreadsheet edits.

DataFrames sit in the computer's memory, so very large datasets may need a database instead. They also carry the usual data pitfalls: columns read with the wrong type, gaps that appear as NaN, and index labels that fail to line up when two tables are combined. The R language offers a similar structure under the name data frame, and several newer libraries copy the idea.

Worked example

An analyst loads five years of daily prices for three made-up banks into a DataFrame with the columns date, ticker and close.

  1. Group the rows by ticker and year and keep the last close of each year
  2. Divide each year-end close by the one before it and subtract one to get yearly returns

A short script turns thousands of rows into a small table of yearly returns that can be rerun whenever new prices arrive.

In practice

Research teams, data journalists and students use DataFrames to clean exchange price files, reconcile company accounts and prepare charts. Statistics bodies such as the ONS publish many datasets as CSV files that load straight into one.

Watch out

  • Combining two DataFrames aligns rows by their labels, so mismatched dates create blanks rather than errors.
  • Editing a slice may or may not change the original table; work on an explicit copy when unsure.

Learn it properly

Official sources

Facts last checked on 4 November 2026.

Education, not advice: the Stockertim Dictionary explains what terms mean. It never recommends buying or selling anything.

English