Pandas min() of selected row and columns
This is a one-liner, you just need to use the axis argument for min to tell it to work across the columns rather than down: df[‘Minimum’] = df.loc[:, [‘B0’, ‘B1’, ‘B2’]].min(axis=1) If you need to use this solution for different numbers of columns, you can use a for loop or list comprehension to construct the … Read more