Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
783 B
1
Indexable
Never
merged_df['Column6'] = merged_df.apply(lambda row: ', '.join(set(str(row['Column3']).split(', ')) - set(str(row['Column4']).split(', '))) if row['Column3'] and row['Column4'] and not pd.isnull(row['Column3']) and not pd.isnull(row['Column4']) else '', axis=1)
merged_df['Column7'] = merged_df.apply(lambda row: ', '.join(set(str(row['Column4']).split(', ')) - set(str(row['Column3']).split(', '))) if row['Column3'] and row['Column4'] and not pd.isnull(row['Column3']) and not pd.isnull(row['Column4']) else '', axis=1)
merged_df['Column8'] = merged_df.apply(lambda row: ', '.join(set(str(row['Column3']).split(', ')) & set(str(row['Column4']).split(', '))) if row['Column3'] and row['Column4'] and not pd.isnull(row['Column3']) and not pd.isnull(row['Column4']) else '', axis=1)
Leave a Comment