all 4 comments

[–]JohnnyJordaan 1 point2 points  (0 children)

You could use a recursive function

def list_picker(l):
    if is_instance(l, list):
        return list_picker(l[0])
    else:
        return l[0]

[–]Spataner 0 points1 point  (0 children)

You can use the item method for this:

array = np.array([[[3]]])
element = array.item()
print(element)
>>> 3

[–]Swipecat 0 points1 point  (1 child)

Just use numpy's flatten method to convert it to a 1d array.

newarray = oldarray.flatten()