I need to get at least for each row and only from columns with 1 in the title, but so that it exceeds the threshold value specified in the max_noise column.
Here is the code creating my demo matrix example.
x = pd.Series([1, 4, 3, 2, 1, 5], [7,1,3,6,7,9]) df = pd.DataFrame({ "A": x**2+8, "B": x*9, "C": x+24, "D": (x*x)+3, "E": (x*2)+5, "F": (3**xx), 'idx':[1,0,1,8,2,1]}) df.columns = df.pop('idx') df['max_noise'] = df.loc[:, df.columns != (1)].max(axis=1) df I can get the columns with the name 1 like this: df.loc[:, (df.columns == 1 | 0) ] But I can not guess how to use the min() function with the condition.
Here is the screen that I want to get in the end:

1means that a particular vector belongs to a cluster. But it is quite possible to add some kind of suffix for uniqueization (for example,1_a, 1_b, 1_c ...), or it may be a multi-index to use. - Mavar 2:38 pm