I have sorted my data frame based on date and then pivot the dataframe, but the pivoted dataframe is not in the order I asked before. It has Dates not in the order.
df1= df1.sort_values(by=['DATE'])
df2=df1.pivot(index='CLIENT', columns=('VISIT_N'), values='DATE')
Can you please help?