I need to refer to specific scipy sparse matrix columns
In pandas I'd write for example:
data_sims.columns[1]
data_sims is csr scipy matrix. if I write data_sims[:,j], then i get all the rows by the column, but i can't reffer to the specific column? How to do it nicely>?
for i in tqdm(range(0, data_sims.shape[0])):
for j in range(1,data_sims.shape[1]):
user = data_sims[i].data
product = data_sims[:,j].data
data_sims has just user's id rows and column names data_sims is <1257x286 sparse matrix of type '' with 1257 stored elements in Compressed Sparse Row format> array([ 1.00000000e+00, 3.30000000e+01, 4.20000000e+01, ..., 1.96620000e+04, 1.96720000e+04, 1.96950000e+04]) –
i would like just to refer to the column for example getcol(2) gives me array of all values in col2 , but is it possible just refer to the col2 instead of getting values of the col2? data_sims.columns[2] –
data_sims[:,j]
is not okay – user2314737