# Long Format

*noun*

say it: **“LAWNG FOR-mat”** **/ˈlɔŋ ˈfɔrmæt/**

A way of laying out a table with one row for each value, and one column for each kind of information, such as student, quiz and score.

## What is **long format** for a table?

A table in **long format** has one row for each value and one column for each kind of value, such as student, quiz and
score. It's longer to read, but simple to filter, group and chart; `pivot()` turns it back into wide format.

```python
import pandas as pd
long = pd.DataFrame({"student_id": [101, 101, 102], "quiz": ["quiz1", "quiz2", "quiz1"], "score": [88, 90, 92]})
print(long.groupby("quiz")["score"].mean())
# quiz
# quiz1    90.0
# quiz2    90.0
```

## In a sentence

- “Grouping by quiz is one line once the scores are in **long format**.”
- “In **long format**, each quiz score has its own row.”

Level: Apprentice · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=2)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/long-format
