TypeError: cannot perform reduce with flexible type

前端 未结 1 1460
夕颜
夕颜 2020-12-03 06:12

I have been using the scikit-learn library. I\'m trying to use the Gaussian Naive Bayes Module under the scikit-learn library but I\'m running into the following error. Type

相关标签:
1条回答
  • 2020-12-03 06:57

    It looks like your 'trainData' is a list of strings:

    ['-214' '-153' '-58' ..., '36' '191' '-37']
    

    Change your 'trainData' to a numeric type.

     import numpy as np
     np.array(['1','2','3']).astype(np.float)
    
    0 讨论(0)
提交回复
热议问题