I have a numpy array X of shape (20000,3):
X = array([[ 3, 8, 4],
[ 1, 2, 4],
...
[ 5, 8, 4],
[ 3, 9, 4]])
I want to drop the last 'column' (i.e. where the 4s are located), to get something like this:
X = array([[ 3, 8],
[ 1, 2],
...
[ 5, 8],
[ 3, 9]])
Do I need to use a list comprehension to do this (i.e. iterate over array elements, save results to a list and convert list to array, or can I use a built-in numpy function, such as extract or where? Maybe you recommend something all together different? Thank you.
y = X[:, :2]