Math of stacking and unstacking

What do stacking and unstacking mean from a mathematical point of view? First one has to understand what it means to represent data in a data frame.

I like to think of a column of a data frame as a function.

I am going to assume that all the columns …