Answers for "python second max in numpy array"

0

python second max in numpy array

>>> k = np.array([[ 35,  48,  63],
...        [ 60,  77,  96],
...        [ 91, 112, 135]])
>>> flat=k.flatten()
>>> flat.sort()
>>> flat
array([ 35,  48,  60,  63,  77,  91,  96, 112, 135])
>>> flat[-2]
112
>>> flat[-3]
96
Posted by: Guest on August-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language