假设:
d = {
'High': [954,
953,
952,
955,
956,
952,
951,
950,
]
}
df = pandas.DataFrame(d)
我想添加另一列,它是从头开始的每个索引的最大值。例如,所需的列将是:
'Max': [954,
954,
954,
955,
956,
956,
956,
956]
我试过一个pandas滚动功能,但窗口似乎不是动态的
答案 0 :(得分:5)
使用startFormat:
["AVSampleRateKey": 16000,
"AVLinearPCMBitDepthKey": 32,
"AVLinearPCMIsFloatKey": 1,
"AVNumberOfChannelsKey": 2,
"AVFormatIDKey": 1819304813,
"AVLinearPCMIsNonInterleaved": 0,
"AVLinearPCMIsBigEndianKey": 0]
endFormatSettings:
["AVSampleRateKey": 16000,
"AVLinearPCMBitDepthKey": 16,
"AVLinearPCMIsFloatKey": 1,
"AVNumberOfChannelsKey": 1,
"AVFormatIDKey": 1819304813,
"AVLinearPCMIsNonInterleaved": 0,
"AVLinearPCMIsBigEndianKey": 0,
"AVEncoderQualityKey": 64]
avconverterError: Error Domain=NSOSStatusErrorDomain Code=-50 "(null)"
cummax
df.High.cummax()
0 954
1 954
2 954
3 955
4 956
5 956
6 956
7 956
Name: High, dtype: int64