I have a numpy array of shape (1,2,3,4,5,6,...) (arbitrary length) and I would like to select the first entry in the first n columns, i.e.,
def select_first_n_0(arr, n):
if n == 1:
return arr[0]
elif n == 2:
return arr[0][0]
elif n == 2:
return arr[0][0][0]
# ...
Is there a more comprehensive expression for this?
idx=(0,0,0).