我很难用技术上的措辞来表达这个问题,所以可能是已经有人提出了这个问题,但是我正在从原始数据库中构建一个DataFrame,并且不得不多次手动更改它。值我把原始的。例如:
ref_data['Weighted_Note_Win'][0] = df['Note_Weighted'][df['accepted'] == 'ACCEPTED'][df['bid week'] == 14].mean()
ref_data['Weighted_Note_Win'][1] = df['Note_Weighted'][df['accepted'] == 'ACCEPTED'][df['bid week'] == 15].mean()
ref_data['Weighted_Note_Win'][2] = df['Note_Weighted'][df['accepted'] == 'ACCEPTED'][df['bid week'] == 16].mean()
ref_data['Weighted_Note_Win'][3] = df['Note_Weighted'][df['accepted'] == 'ACCEPTED'][df['bid week'] == 17].mean()
ref_data['Weighted_Note_Win'][4] = df['Note_Weighted'][df['accepted'] == 'ACCEPTED'][df['bid week'] == 18].mean()
对于每个,我必须将行调整一个并手动重新输入该值。有没有一种单一的方法可以有效地进行迭代以减少耗时?
谢谢!