我有两个表用于平均值和标准差,我想计算平均值表的某些列的最大值,并且我想获取标准表的相应行。
mean_df = pd.read_csv(r'./csvs/mean.csv')
std_df = pd.read_csv(r'./csvs/std.csv')
#mean_df, std_df are of same size
grouped_df = mean_df.groupby(['alpha', 'beta'])
columns = ['val']
max_df = grouped_df[columns].agg(['max'])
# Here i want the corresponding std_max_df table for the max_df. i.e., for every max calculated from mean, i want the std of that max in a new table.
例如:
输入mean_df是
αβ伽马陷阱
1 2 3 100
4 6 8 200
1 2 9 400
4 6 7 500
3 5 8 600
输入std_df 是
αβ伽马陷阱
1 2 3 300
4 6 8 500
1 2 9 100
4 6 7 700
3 5 8 900
输出将是
alpha beta gamma max_mean_val corresp_std_val
1 2 9 400 100
4 6 7 500 700
3 5 8 600 900
幕布斯7119047
相关分类