0

I was wondering how I could unstack each year separately into its own column from the dentist.csv file found here https://www.kaggle.com/utkarshxy/who-worldhealth-statistics-2020-complete?select=safelySanitization.csv

Dataframe display

Thanks

Engineero
  • 12,340
  • 5
  • 53
  • 75
DeAbdul
  • 1
  • 1
  • Try to read through this documentation. Pivot is the right approach. The examples in the link [Reshaping and pivot tables](https://pandas.pydata.org/docs/user_guide/reshaping.html) should help you – Joe Ferndz Oct 19 '21 at 16:58

1 Answers1

0

Use df=dent.groupby("period") To group the data and then apply df.unstack(level=-1) to unstack

Somu Nath
  • 33
  • 5