Wide and narrow data


Wide and narrow are terms used to describe two different presentations for tabular data.

Wide

Wide, or unstacked data is presented with each different data variable in a separate column.
PersonAgeWeightHeight
Bob32128180
Alice2486175
Steve6495165

Narrow

Narrow, stacked, or long data is presented with one column containing all the values and another column listing the context of the value
PersonVariableValue
BobAge32
BobWeight128
BobHeight180
AliceAge24
AliceWeight86
AliceHeight175
SteveAge64
SteveWeight95
SteveHeight165

This is often easier to implement; addition of a new field does not require any changes to the structure of the table, however it can be harder for people to understand.

Implementations

Many statistical and data processing systems have functions to convert between these two presentations, for instance the R programming language has several packages such as the package. The pandas package in Python implements this operation as function which converts a wide table to a narrow one. The process of converting a narrow table to wide table is generally referred to as "pivoting" in the context of data transformations. The "pandas" python package provides a method which provides for a narrow to wide transformation.