ValueError: Data must be positive (boxcox scipy)

后端 未结 3 1996
深忆病人
深忆病人 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:09

    Rather than normal boxcox, you can use boxcox1p. It adds 1 to x so there won't be any "0" record

    from scipy.special import boxcox1p
    scipy.special.boxcox1p(x, lmbda)
    
    

    For more info check out the docs at https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.boxcox1p.html

提交回复
热议问题