I am trying to add a count of all the matches between dataframes a & b
df2['Count'] = len(set(a) & set(b))
df2.head(5)
But it only returns "0"
Data for a:
Result | Column1 | Column2 | Column3 | D-level | R-level |
---|---|---|---|---|---|
numpy | de | LA | 11060303 | 8 | NaN |
FRA | Paris | YouTube | 56764332 | 1 | 4.0 |
Here is the data for b:
numpy
File Edit View —Insert_ © Cell~—«KKemmel_«- Widgets. Help tT | Python 3 (ipykernel) @
@ B & % mR MC PM Code » 2
YouTube
import numpy
Desired output should be a total of matches between a and b appended to the dataframe:
Result | Column1 | Column2 | Column3 | D-level | R-level | No of matches? |
---|---|---|---|---|---|---|
numpy | de | LA | 11060303 | 8 | NaN | (1 unique match) |
FRA | Paris | YouTube | 56764332 | 1 | 4.0 | (1 unique match) |
Best,