Reshaping Data

In this lesson, some data reshaping techniques are discussed.

We'll cover the following...

Reshaping

Reshaping is considered a powerful tool for getting the data ready for analysis. It transforms the initial data model into the desired shape to ease the cleaning and manipulation of data for further analysis. This technique is usually performed on a Series or DatFrame with multiple indexes.

Three techniques are mostly used to reshape data, and pandas provide built-in functions for all of them.

  • Stacking

  • Unstacking

  • Pivoting

Stack

Stacking a pandas DataFrame means taking the innermost level of column index from a multi-indexed DataFrame and adding it as another level to the innermost ...

Access this course and 1400+ top-rated courses and projects.