I have an array of probabilities:
proba = :[[0.254 0.556 0.025] [0.898 0567 .112]]
want max value from each as [[0.556] [0.898]]
How i can do it? Tried 2 methods:
1. max(sublist) for sublist in proba
2. proba = map(max,proba)
and getting error "TypeError: 'numpy.float32' object is not iterable"
Any suggestion?
I can notice some problems in your code, first of all, your data list is not in the correct format, commas are missing and there is an extra ':' at the right of the equal sign
proba = [[0.254, 0.556, 0.025], [0.898, 0.567, .112]]
And then you can get the answer like this :
max_ = [max(i) for i in proba]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With