我是 Python 初学者,我有以下代码:
levage_mean = df.groupby('cum_cycle_id')['levage'].mean().rename("levage_mean")
levage_min = df.groupby('cum_cycle_id')['levage'].min().rename("levage_min")
levage_max = df.groupby('cum_cycle_id')['levage'].max().rename("levage_max")
levage_sum = df.groupby('cum_cycle_id')['levage'].sum().rename("levage_sum")
load_min= df.groupby('cum_cycle_id')['load'].min().rename("load_min")
load_max = df.groupby('cum_cycle_id')['load'].max().rename("load_max")
load_mean = df.groupby('cum_cycle_id')['load'].mean().rename("load_mean")
load_sum = df.groupby('cum_cycle_id')['load'].sum().rename("load_sum")
load_median = df.groupby('cum_cycle_id')['load'].median().rename("load_median")`
我想把它放在一个循环中,因为它太重复了,我该怎么办?
谢谢您的回复!
繁华开满天机
相关分类