我有这个代码(机器学习)如下:
from scipy.special import boxcox1p
from scipy.special import boxcox
from scipy.special import inv_boxcox
df_trans=df1.apply(lambda x: boxcox1p(x,0.0))
其中df1
是包含日期和一些其他值的 Dataframe
但是,在运行上面的代码后,我得到了这个错误:
TypeError Traceback (most recent call last)
Input In [585], in <cell line: 4>()
2 from scipy.special import boxcox
3 from scipy.special import inv_boxcox
----> 4 df_trans=df1.apply(lambda x: boxcox1p(x,0.0))
TypeError: ufunc 'boxcox1p' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
我该如何解决这个问题?
编辑:这是代码示例的一部分:
Quantity Price Difference Money Received
0 55419 12.908304 8.518790 69665.133754
1 45179 28.492719 8.518790 125359.752289
2 11985 17.040535 18.776097 19888.813469
1条答案
按热度按时间nnvyjq4y1#
这个问题的答案是排除日期列。特别感谢@AlexK的帮助!