If I have DataFrame:
df_d = {'Element':['customer full name','full name','name','religion','account number','lgbt','lgbt identity']}
df = pd.DataFrame(data=df_d)
df['Match'} = ''
And I have dictionary:
d = {'name':'Contact', 'religio':'Behavioral', 'lgbt':'Identity'}
How can I populate df['Match'] with the dictionary value if the Element CONTAINS the dictionary key? I can have it populate the column for full matches:
for i in range(len(df)):
if df['Element'][i] in d:
df['Match'][i] = d[df['Element'][i]]
But I can't get it to work for partial Element matches. Sorry, my browser won't allow me to copy and paste the cell outputs. Thanks!