numpy subarray python

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

Here is what the above code is Doing:
1. Create a 3×3 array of integers.
2. Print the entire array.
3. Print the first column of the array.

Note that the first column is printed as a 2D array. This is because the first column is a 2D array.

Now let’s try to print the first row of the array:

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