【发布时间】:2018-01-25 13:56:07
【问题描述】:
我希望在以下 df 中添加一列“到期”:
In [157]: df
Out[157]:
atmVol t
0 0.043220 0.02
1 0.042139 0.04
2 0.041174 0.06
3 0.040328 0.08
4 0.039606 0.10
5 0.038364 0.15
6 0.037971 0.20
7 0.038480 0.25
试过这个:
df['expiry'] = df.apply(lambda x: datetime.utcnow() + timedelta(x.t * 365)
返回一个 AttributeError: ("'Series' object has no attribute 't'", 'occured at index atmVol')
我在这里做错了什么?感谢您的帮助。
【问题讨论】:
标签: python pandas datetime python-3.6