How to check that a matrix contains a zero column?

numpy, python

Solution

Here's one way:

In [19]: a
Out[19]: 
array([[9, 4, 0, 0, 7, 2, 0, 4, 0, 1, 2],
       [0, 2, 0, 0, 0, 7, 6, 0, 6, 2, 0],
       [6, 8, 0, 4, 0, 6, 2, 0, 8, 0, 3],
       [5, 4, 0, 0, 0, 0, 0, 0, 0, 3, 8]])

In [20]: (~a.any(axis=0)).any()
Out[20]: True

If you later decide that you need the column index:

In [26]: numpy.where(~a.any(axis=0))[0]
Out[26]: array([2])

Problem

I have a large matrix, I'd like to check that it has a column of all zeros somewhere in it. How to do that in numpy?

Original source