Slice 2D NumPy Array
Extract the first column of the NumPy array.
import numpy as np
a = np.array([
[3, 1, 7],
[4, 9, 2],
[12, 3, 1],
[12, 11, 8]
])
# slice first column here...
col =
print(col)
# expected: [3 4 12 12]
Python
Setting up Python environment...
Output