Home > Blockchain >  how to find the every single letter into the row is equal to the other row in the columns pandas?
how to find the every single letter into the row is equal to the other row in the columns pandas?

Time:01-18

How to show validate in pandas each row in A and B columns is same name and last name? i am trying to make it in pandas python

Input enter image description here

output enter image description here

i dont have any idea

CodePudding user response:

Always provide a code snippet on what you have already tried. At least a pseudo code.

Anyway, Give this a shot:

df['col3'] = df.apply(lambda row: True if row['col1'] == row['col2'] else False, axis=1)

CodePudding user response:

Your question needs some clarification as suggested by @yeaske but I feel the following code logic maybe more correct as per your input and output.

df['result'] = df.apply(lambda row: row['col2'].lower().startswith(row['col1'].lower()), axis=1)
  • Related