df2 = df.copy()
df2['avgTemp'] = df2['avgTemp'] * tempchange
df2['year'] = df2['year'] + 20
df_final = pd.concat([df,df2])
OUTPUT:
Country avgTemp year
0 Afghanistan 14.481583 2012
0 Afghanistan 15.502164 2032
1 Africa 24.725917 2012
1 Africa 26.468460 2032
2 Albania 13.768250 2012
... ... ... ...
240 Zambia 21.697750 2012
241 Zimbabwe 23.038036 2032
241 Zimbabwe 21.521333 2012
242 Åland 6.063917 2012
242 Åland 6.491267 2032
So currently I'm trying to make a loop so I can then do the same calculations for "df_2" and return "df_3", and keep doing this until I have a certain amount of new dataframes that I can then concatinate together. Thank you for your help! :)
So end result should be like df_1, df_2, df_3 and so on. So I can then concat them together into one big dataset