Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 188 characters in body
Source Link
jezrael
  • 867.8k
  • 103
  • 1.4k
  • 1.3k

Use DataFrame.merge with left or outer join and indicator parameter, for boolean compare by both:

df = df1.merge(df2, how='left', indicator='is_match') df['is_match'] = df['is_match'].eq('both') 

Use:

df = df1.merge(df2, how='left', indicator='is_match') df['is_match'] = df['is_match'].eq('both') 

Use DataFrame.merge with left or outer join and indicator parameter, for boolean compare by both:

df = df1.merge(df2, how='left', indicator='is_match') df['is_match'] = df['is_match'].eq('both') 
Source Link
jezrael
  • 867.8k
  • 103
  • 1.4k
  • 1.3k

Use:

df = df1.merge(df2, how='left', indicator='is_match') df['is_match'] = df['is_match'].eq('both')