I have the following dataframe:
import pandas as pd
import numpy as np
df = pd.DataFrame({
'Year': [2022,2022,2022,2022,2022,2022,2022,2022],
'Quarter':[2,2,2,2,1,1,2,2],
'Product':['Car','Bike','Car','Bus','Bike','Bus','Car','Bike'],
})
df
I am trying to group by Year
and Quarter
whilst transposing the Product
column to have all uniqiue values getting their own column.
My expected output is this, with just a basic count of the values. Any help would be much appreciated! Thanks!