How to put the max of 3 separate columns in a new column in python/pandas

for example we have: a b c 1 1 3 2 4 1 3 2 1 And now using python I’m trying to create this: a b c max 1 1 3 3c 2 4 1 4b 3 2 1 3a >Solution : If need match first maximal column join max converted to strings with… Read More How to put the max of 3 separate columns in a new column in python/pandas

Index of maximum value of each row of an array in Python

I have an array Pr. I want to print index of maximum value of each row. For example, for row 0, the maximum value is 1.72731864e+003 and it occurs at index 0. I present the expected output. import numpy as np Pr = np.array([[1.72731864e+003, 0.00000000e+000], [0.00000000e+000, 1.24439020e+003]]) MaxPr=Pr.max(axis=1) The expected output is indices=[0,1] >Solution :… Read More Index of maximum value of each row of an array in Python