I have a dataframe with two columns, both of type int64. I'm trying to convert my pandas dataframe into a scipy csr_matrix using the following lines of code:
s = all_raw[['a','b']] // my dataframe two two columns of type int64
t1 = s.as_matrix(columns = None)
t2 = scipy.sparse.csr_matrix(t1)
This is how t1
looks like
array([[3, 1],
[3, 0],
[1, 1],
...,
[1, 1],
[2, 0],
[2, 1]], dtype=object)
I'm getting the following error message
../anaconda/envs/python3/lib/python3.6/site-packages/scipy/sparse/sputils.py in upcast(*args)
49 return t
50
---> 51 raise TypeError('no supported conversion for types: %r' % (args,))
52
53
TypeError: no supported conversion for types: (dtype('O'),)
What's going on wrong here?