pandas get the row-wise minimum value of two or more columns

If you like to get a single minimum value of multiple columns:

data[['flow_h','flow_c']].min().min()

the first "min()" calculates the minimum per column and returns a pandas series. The second "min" returns the minimum of the minimums per column.


If you are trying to get the row-wise mininum of two or more columns, use pandas.DataFrame.min and specify axis=1.

data['min_c_h'] = data[['flow_h','flow_c']].min(axis=1)

# display(data)
   flow_c  flow_d  flow_h  min_c_h
0      82      36      43       43
1      52      48      12       12
2      33      28      77       33
3      91      99      11       11
4      44      95      27       27
5       5      94      64        5
6      98       3      88       88
7      73      39      92       73
8      26      39      62       26
9      56      74      50       50