0

I have a pandas dataframe which is like

df = pd.DataFrame({
'Country': ['GER', 'ITA'],
'2000': ['1','4'],
'2001': ['2','5'],
'2002': ['3','6'],
 })

which means the data are like

   Country 2000 2001 2002
 0 GER     1    2    3
 1 ITA     4    5    6

and I want to take the values of the columns and create a new dataframe where these values are part of the key

   Country Year  Value
 0 GER     2000  1
 1 GER     2001  2     
 2 GER     2003  3     
 3 ITA     2000  4 .....

how can I can do something like this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Michail N
  • 3,647
  • 2
  • 32
  • 51

0 Answers0