Numpy.dot TypeError: Cannot cast array data from dtype('float64') to dtype('S32') according to the rule 'safe'

前端 未结 2 1777
北海茫月
北海茫月 2020-12-20 10:45

Why am I getting this error when using np.dot(a,b.T):

TypeError: Cannot cast array data from dtype(\'float64\') 
               to dtype(\'S32\'         


        
2条回答
  •  借酒劲吻你
    2020-12-20 11:23

    Try converting whole numpy array into float Example:

    train = train.astype(float)
    train_target = train_target.astype(float)
    

提交回复
热议问题