I have dataframe df which has one column:
colors
red
blue
green
black
pink
And another dataframe df1 which has many columns (~300 columns):
colorName col1 col2 ... colN
pink 1 0 1 ... 0
white 0 1 1 ... 1
blue 1 0 0 ... 0
yellow 0 0 0 ... 0
What I need is to return the rows of df in which it exists in df1.colorName and have at least value 1 in any of the columns (col1 ... colN)
So, from the above; the output should be:
blue
pink
I'm starting with this but I'm sure it needs an additional condition for (checking have at least value 1 in any of the columns (col1 ... colN))
newDF = df[df.colors.isin(df1.colorName) && ]
Correct me if I'm wrong and any help would be appreciated.