McLeodx McLeodx - 23 days ago 4x
Python Question

Maximum value of certain element of all arrays in np array

I have a numpy array with arrays within it:


How am I able to find the maximum of all of the last elements of these inner arrays? ie. for this case the return would be 9

I'm able to do this by converting to a Pandas dataframe first, but this is slowing down the program and I'm sure there's an easier way just using np.


Assuming that you meant to write


then you can slice the last column with A[:,-1] and call .max().