numpy - Delete columns of matrix of CSR format in Python -
i have sparse matrix (22000x97482) in csr format , want delete columns (indices of columns numbers stored in list)
you can use fancy indexing obtain new csr_matrix
columns have in list:
all_cols = np.arange(old_m.shape[1]) cols_to_keep = np.where(np.logical_not(np.in1d(all_cols, cols_to_delete)))[0] m = old_m[:, cols_to_keep]
Comments
Post a Comment