ValueError: Data must be positive (boxcox scipy)

后端 未结 3 1998
深忆病人
深忆病人 2021-01-23 15:46

I\'m trying to transform my dataset to a normal distribution.

0      8.298511e-03
1      3.055319e-01
2      6.938647e-02
3      2.904091e-02
4      7.422441e-0         


        
3条回答
  •  无人共我
    2021-01-23 16:06

    Is your data that you are sending to boxcox 1-dimensional ndarray?

    Second way could be adding shift parameter by summing shift (see details from the link) to all of the ndarray elements before sending it to boxcox and subtracting shift from the resulting array elements (if I have understood boxcox algorithm correctly, that could be solution in your case, too).

    https://docs.scipy.org/doc/scipy-0.16.1/reference/generated/scipy.stats.boxcox.html

提交回复
热议问题