0

I want to convert this wide format of tables in pandas to:

       Jan  Feb Mar Apr may jun jul aug sep oct nov dec
2019    0   0   0   0   0   0   0   0   0   0   0   0
2020    0   0   0   0   0   0   0   0   0   0   0   0
2021    0   0   0   0   0   0   0   0   0   0   0   0

in this format:

YEAR    MON dd

2019    DEC 0

2019    NOV 0

2019    OCT 0

2019    SEP 0

2019    AUG 0

2019    JUL 0

2019    JUN 0

2019    MAY 0

2019    APR 0

2019    MAR 0

2019    FEB 0

2019    JAN 0

2018    DEC 0

How can this be done ?

Nk03
  • 14,699
  • 2
  • 8
  • 22

1 Answers1

0

df.transpose() can make your columns the rows and your rows the columns.

Gavin Wong
  • 1,254
  • 1
  • 6
  • 15