更新时间:2023-10-04 19:27:22
如果您希望所有列+函数产生的新列,您可以这样做:
If you want all the columns + the new column which is the result of your function, you can do so:
df['result'] = calc_funct(df['x'], df['y'], df['z'])
或仅date
和result
以及另一行代码:
or just date
and result
with this other line of code:
df = df[['date','result']]
编辑
result = []
for index, row in df.iterrows():
result.append(row['date'])
result.append(calc_funct(row['x'], row['y'], row['z']))
print result