Original data frame has all 3 columns i.e. name, description and specialties columns in it.
I want to input a company name, compare its specialties with all other companies' specialties and during comparison whenever I found a match I want to print and save all the details of the found match.
df_descrip = df_original[['name', 'description']]
df_spec = df_original[['name','specialties']]
INPUT ='TOTAL'
all_names = df_original['name']
df_original = df_original.set_index('name', drop = False)
columns = df_original.columns
for index, row in df_original.iterrows():
if row['name'] == INPUT:
specialties_input = df_original.loc[INPUT,'specialties']
print('INPUT SPECIALTIES: ', specialties_input)
for spec in specialties_input:
for item in df_spec['specialties']:
if spec in item:
# here I want to display details of a match
NOTE: Suppose If I input company name 'TOTAL' and it has 5 specialties (s1,s2,s3,s4,s5) I will compare all of them with the specialties of all companies in my data frame. let's say I find a match i-e s3 in specialties, how can I get the name of the matched company ?