Get the list of all possible numpy array column deletions

Given the following numpy array:

>>> a = np.arange(9).reshape((3, 3))
>>> a
array([[0, 1, 2],
       [3, 4, 5],
       [6, 7, 8]])

How can get the list of all possible column deletions? So in this case:

array([[[1, 2],
        [4, 5],
        [7, 8]],

       [[0, 2],
        [3, 5],
        [6, 8]],

       [[0, 1],
        [3, 4],
        [6, 7]]])


Read more here: https://stackoverflow.com/questions/66305554/get-the-list-of-all-possible-numpy-array-column-deletions

Content Attribution

This content was originally published by cabralpinto at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: