Issue
I'm a student who's relatively new to python and pandas/matplotlib etc. so take it easy on me please
I have a dataframe of a weather data .csv. I tried to split it into dataframes north, south, east , west and one df which contains the year columns to take it as the x-axis for plt.plot. My problem is: I'm trying to get the df_East, df_West etc. dataframes which contain the columns of multiple states of the original dataframe as one df_East-column etc. which contains only one column with the mean value of all columns of each row because I can't plot e.g. df_East as one curve and compare it to df_North If I made it sound complicated some pseudocode: Temperature in degree celcius
df_East=df_All["stateInEast1","stateInEast2"..]
print df_East["stateInEast1"]=1990 : 12; 1991: 12.5 etc.
now I want df_East to be one column df_East["meanOfAllMyStates]=1990 : 12.3, 1991 : 12.7
so I can compare it at date 1990 with the mean of df_North and df_West's "mean column"
Solution
df_East["meanOfAllMyStates"] = df_East.mean(axis=1)
Answered By - AmineBTG
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.