从示例数据帧df
开始,如:
a,b
0,0.71
1,0.75
2,0.80
3,0.90
我将添加一个新列,其指数值为列b
。到目前为止,我试着:
df['exp'] = math.exp(df['b'])
但此方法返回:
"cannot convert the series to {0}".format(str(converter)"
TypeError: cannot convert the series to <type 'float'>
是否有方法将math
函数应用于整个列?
Tags:
好吧} ,它可以对整个列进行矢量化,从而对整个列进行操作:
math.exp
不理解Series
数据类型,请使用numpy^{尝试使用:
相关问题 更多 >
编程相关推荐