I am trying to do this:
features = csr_matrix(features)
where features
is a <class 'numpy.ndarray'>
and looks like that:
[[51 1]
[49 2]
[47 2]
...
[2 6]
[20 2]
[16 1]]
but I get the following error:
TypeError: no supported conversion for types: (dtype('O'),)
What is this error about and how can I fix it?
You may redefine your numpy array specifying the dtype
explicitly
features = np.array(features, dtype=float)
Do this:
csr_matrix(features.astype(np.float))
If this has an error, then you have things that aren't numbers in your features.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With