I need to convert a part of my data to make it compatible with this solution: https://stackoverflow.com/a/64854873
The data is a pandas.core.frame.DataFrame
with:
result data_1 data_2
1 1.523 4 1223
3 1.33 84 1534
Some index values might be removed, therefore 1, 3, ...
It should be a tuple with data values and the result. The type in the solution was scipy.sparse._coo.coo_matrix
, like:
(4, 1223) 1.523
(84, 1534) 1.33
Just scipy.sparse.coo_matrix(df.values)
seems to mix the data.
(0, 0) 1.523
(0, 1) 1.53
(0, 24) 1.92
: :
(2, 151) 123.0
(2, 142) 834.0
How can I generate a compatible matrix?
source https://stackoverflow.com/questions/73743532/data-set-convert-to-matrix-with-tupel
Comments
Post a Comment