I want to check if two csr_matrix are equal.
If I do:
x.__eq__(y)
I get:
raise ValueError(\"The truth value of an a
What worked best for my case was (using a generic code example):
bool_answer = np.arrays_equal(sparse_matrix_1.todense(), sparse_matrix_2.todense())
You might need to pay attention to the equal_nan parameter in np.arrays_equal
The following doc references helped me get there: CSR Sparse Matrix Methods CSC Sparse Matrix Methods Numpy arrays_equal method SciPy todense method