How do I convert a numpy matrix into a boolean matrix?
You should use array.astype(bool) (or array.astype(dtype=bool)). Works with matrices too.
I have a n x n matrix in numpy which has 0 and non-0 values. Is there a way to easily convert it to a boolean matrix?
Thanks.