Get unique rows from a Scipy sparse matrix
问题 I'm working with sparse matrices in python, I wonder if there is an efficient way to remove duplicate rows in a sparse matrix, and have only the unique rows remain. I did not find a function associated with it and not sure how to do it without converting the sparse matrix to dense and use numpy.unique. 回答1: There is no quick way to do it, so I had to write a function. It returns a sparse matrix with the unique rows (axis=0) or columns (axis=1) of an input sparse matrix. Note that the unique