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
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)