Skip to content

Stockertim Dictionary · Technology

pandas

Also called pandas library, Python pandas, pandas package

In short

A free, open-source Python library for working with tables of data: reading files, filtering rows, grouping and totalling, joining tables and drawing simple charts.

  • Beginner
  • Technology
  • Checked

In detail

pandas is the most widely used Python library for tabular data. Its central object is the DataFrame, a table with named columns and a row index, and a single column is a Series. It is open-source software released under a permissive licence, and it is conventionally imported with the short name pd, as in import pandas as pd.

Typical work follows a short sequence. pd.read_csv('sales.csv') loads a file; df.head() shows the first rows and df.info() lists the columns, their types and how many values are missing. A condition in square brackets keeps matching rows, df.groupby('region')['amount'].sum() totals by group, pd.merge joins two tables on a key, and df.plot draws a quick chart.

Most operations act on whole columns at once, so one line can convert a currency, flag late payments or calculate a ratio for every row without a loop. Because each step is written down, the analysis can be rerun on next month's file, reviewed by a colleague and kept under version control, which suits the reproducible analytical pipelines that government statisticians promote.

The library has its pitfalls. Columns may load with the wrong type, such as numbers with commas read as text. Missing values appear as NaN and are skipped by most sums and means. Merges can multiply rows when keys repeat. And because a DataFrame sits in memory, very large data sets may need a database or a different tool.

Worked example

An analyst at a co-operative in Mbale loads 3,000 coffee deliveries from a CSV file to total kilograms by village.

  1. df = pd.read_csv('deliveries.csv') loads 3,000 rows.
  2. df.groupby('village')['kg'].sum() gives totals for 12 villages that add up to 150,000 kg.
  3. Average per delivery: 150,000 / 3,000 = 50 kg

Three lines of code produce the village table, and they can be rerun unchanged on next season's file.

In practice

Analysts, statisticians, researchers and data journalists use pandas to clean exports, reconcile figures and prepare tables and charts. Official bodies publish many datasets as CSV files that load straight into it, and AI coding assistants often draft pandas code that the analyst then reads and tests.

Watch out

  • Check df.info() after loading: a numeric column read as text produces wrong sums or none at all.
  • Compare row counts before and after each merge to catch duplicated keys.

Learn it properly

Official sources

Facts last checked on 9 November 2026.

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

English