How to merge two dataframes with different variations of a column values?
Use .count to count how many times United States is stated in the list and then make an if command to see if united stated is listed more than once in the list. Do it to all of the other options and make a final if command to check if either any of them are in the list to output the value that you want.
I have two data frames that I want to merge on a same column name but the values can have different variations of a values.
Examples. Variations of a value :




Variations




USA


US


United States


United States of America


The United States of America




And let's suppose the data frames as below:
df1 =




country
column B




India
Cell 2


China
Cell 4


United States
Cell 2


UK
Cell 4




df2 =




Country
clm




USA
val1


CH
val2


IN
val3




Now how do I merge such that the United States is merged with USA?
I have tried DataFrame merge but it merges only on the matched values of the column name.
Is there a way to match the variations and merge the dataframes?