Hi I am using pandas pivot functionality .
df1=pd.pivot_table(df, index=[week_column,'Rank_Trx'],columns='Target channel',values= [id_column],aggfunc=pd.Series.nunique)
The output I receive is something like this.
However the output i am looking for should look like this.
So the columns of the data frame I wish to have should be "Period","Rank_Trx","PDE","Samples","Take no action" Basically I want this a NxN data frame without any multilevel index . I am using the latest pandas version 1.0.5