ufunc 'boxcox1p' not supported for the input types. the inputs could not be safely coerced to any supported types according to the casting rule 'safe'

Question:

I’m having this code (for machine learning) below:

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))

With df1 being a dataframe containing date and some other values

However, after running the above codes, I got this error:

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''

How do I fix this?

Edited: This is part of the code sample:

    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
Asked By: Bored ᓚᘏᗢ

||

Answers:

The answer for this is to exclude date column. Special thanks to @AlexK for helping!

Answered By: Bored ᓚᘏᗢ
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.