【发布时间】:2019-03-21 00:36:19
【问题描述】:
有没有更快的方法来处理这段代码? 我只想计算 t_last - t_i 并创建一个新列
time_ges = pd.DataFrame()
for i in range(0, len(df.GesamteMessung_Sec.index), 1):
time = df.GesamteMessung_Sec.iloc[-1]-df.GesamteMessung_Sec.iloc[i]
time_ges = time_ges.append(pd.DataFrame({'echte_Ladezeit': time}, index=[0]), ignore_index=True)
df['echte_Ladezeit'] = time_ges
这段代码需要大量的计算时间,有没有更好的方法来做到这一点? 谢谢,R
【问题讨论】:
标签: python pandas performance for-loop