Search⌘ K
AI Features

Pivot—Long and Wide Formats

Explore how to manipulate data by converting between long and wide formats with pandas pivot techniques. Understand the advantages of each format and how to apply them to organize, analyze, and visualize your data effectively.

Long and wide data formats

Data is generally presented in two types of format—long and wide. For data in a long format, each subject contains data represented across more than one row. On the other hand, for data in a wide format, each subject contains data represented in a single consolidated row only.

Illustration of long and wide data formats
Illustration of long and wide data formats

In the example above, we see that the long format stacks ...