This might be a trivial question but I\'m still trying to figure out pandas/numpy.
So, suppose I have a table with the following structure:
group_id
['col1', 'col2', 'col3']
1
with eq(1)
equivalent to == 1
axis=1
with any(1)
loc
to make assignmentanyone = df[['col1', 'col2', 'col3']].eq(1).any(1)
df.loc[anyone, 'A'] = np.nan
numpy equivalent
anyone = (df[['col1', 'col2', 'col3']].values == 1).any(1)
df.A = np.where(anyone, np.nan, df.A)
To get the minimum of column A for each group use transform
df.groupby('group_id')['A'].transform('min')