May-16-2022, 12:25 PM
(May-16-2022, 10:24 AM)Pedroski55 Wrote: Haha, what a wonderful thing the Internet is: instant answers
I could never have got to this on my own!
df['Result'] = df['Type'].isin(df.loc[df['Var1'].eq(3), 'Type']).astype(int) df['Result'] = np.where(df['Type'].isin(df.loc[df['Var1'].eq(3), 'Type']), 1, 0) df['Result'] = df['Var1'].eq(3).groupby(df['Type']).transform('any').astype(int)
Thank you so much, it works !! :D