Performance benefits of stacked data
Finally, we will examine why we would want to stack data. It can be shown that stacked data is more efficient than using lookup through a single level index and then a column lookup, or even compared to an .iloc
lookup that specifies the row and column by location. The following demonstrates this:

This can have extreme benefits on an application performance if it is required to repeatedly access a large number of scalar values out of a DataFrame
.