I am trying to get familiar with python coding and I would like to ask a little help in the following task.
I have imported two data frames from excel dfA and dfB with pandas. I would like to count the matches of each lines from dfA in dfB.
To do this I converted dfSearch = dfA['Title'].tolist()
to pass this as a list of values to search for.
My approach is the following:
for i in searchDF:
result = dfB['COL1'].count(i)
Then I would like to add a new column in dfA which will store the results of each line.
dfA['FIND_VAL1'] = result
I am sorry if this task seems trivial, but I am completely new to python and rally need some help.
Data example A:
title
plane
house
car
Data example B:
title
aero plane
household
luxury cars
house decorations
Result example:
title Results
plane 1
house 2
car 1