.max() for dataframe converts object type to float64

df.apply(lambda x: '{:e}'.format(max(x['A'], x['B'])), axis=1)

If values of ‘A’ and ‘B’ are strings:

df.apply(lambda x: '{:e}'.format(max(float(x['A']), float(x['B']))), axis=1)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top