Reshaping the Data

This lesson explains the possible ways to reshape and arrange the data using Pandas.

Pivot Table #

Somewhat like Excel, we can pivot our data using pandas pivot_table functionality. To do so, we will use the pivot_table() function.

The values parameter is the column being used for aggregation, the index parameter is for the index values that creates multiple rows, and the columns parameter is for the value on which you want to have multiple columns created.

You can also use the aggfunc parameter to pass a function with which to aggregate your pivots.

Let’s look at an example:

Get hands-on with 1200+ tech skills courses.