Pivoting data

PHOTO EMBED

Sat Jan 23 2021 20:49:29 GMT+0000 (Coordinated Universal Time)

Saved by @exe

pd.pivot_table(df, index='Company',
              columns='Department',
              values='Employees')
content_copyCOPY

This method takes many arguments which you can find in the documentation, but for now we will look at three of these: index: the column you want to set as index columns: the column which will be transformed to a new column for each unique value. values: which column will be the value in each cell.