'Optimized way of matching information from 2 dataframes based on strings

I have information on two distinct dataframes and I can only match them by their name. The problem is the names are different for both dataframes. So currently my plan is to match them by using in due to most of them only differ by one word:

Example:

Dataframe 1: 'Viazem XL 360mg'

Dataframe 2: 'Viazem XL 360mg capsules'

i = 0 
for i in range (df1.shape[0]):
    j = 0
    for j in range (df1.shape[0]):
        if (df2['name'][j] in df2['name'][i]):
            df1['Documents'].iloc[i] = df2['Documents'].iloc[j]
            break 

I'm using a for cycle but that takes a lot of time, what can be a faster approach?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source