在对dataframe中的一列做log变换时
试图使用math.log(df['col1'])
,提示错误:
TypeError: cannot convert the series to <class ‘float’>
正确方法:
df['col1'].apply(np.log)
方法来源于:
Pandas入门:对一列取指数/对数
在对dataframe中的一列做log变换时
试图使用math.log(df['col1'])
,提示错误:
TypeError: cannot convert the series to <class ‘float’>
正确方法:
df['col1'].apply(np.log)
方法来源于:
Pandas入门:对一列取指数/对数