Reputation: 41
My dataframe look like this:
Month Aug Sep Oct Nov Dec
Year
2015 -0.087763 -0.044687 0.074335 -0.047496 0.009380
2016 -0.016767 0.017330 -0.019376 0.032446 -0.008402
2017 -0.015696 -0.017499 0.047880 0.017623 -0.008918
2018 -0.032041 0.013559 -0.073149 0.032732 -0.015669
2019 -0.058844 0.004336 0.035221 -0.011134 0.009052
mean -0.030830 -0.010107 0.009877 0.013574 0.021104
I like to extract the last row("mean") so I can put inside a list.
I tried the following:
a = df_final.tail(1).values.tolist()
---> result below:
[[0.009656344803844981,
0.009396282528774218,
0.007030633691263447,
0.02658556550533946,
-0.007079112777794713,
0.0016991287767502451,
0.014585248218691213,
-0.03082982444347945,
-0.010107077716506988,
0.009877350168478648,
0.013574204095420709,
0.02110427999089128]]
How do I remove the extra brackets so I can use this list to insert into another dataframe?
Any help would be very much appreciated. Thanks!
Upvotes: 1
Views: 53