Python错误:使用iloc取消损坏类型:“列表”

2024-05-19 01:35:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我还在学习Python。我试图使用下面的if语句检查任何平均温度的峰值是否满足要求,但我得到了TypeError:unhabable type:'list'。有人能帮助澄清问题并纠正它吗

谢谢大家!

df['T1avg'] = df['T1'].rolling(11, center=True).mean().shift(50)
df['T2avg'] = df['T2'].rolling(11, center=True).mean().shift(50)
averages = ['T1avg','T2avg']

pctl = np.nanpercentile(df, 1, axis=0)  # calculation of 1% percentile
peak = df.iloc[-1] < pctl

for i in range(1, len(df)):
if (peak.loc(axis=0)[i, averages]).any():

Tags: truedfifshift语句meancenterrolling

热门问题