I have a column containing symbols of chemical elements and other substances. Something like this:
| Commoditie |
|---|
| sn |
| sulfuric acid |
| cu |
| sodium chloride |
| au |
df1 = pd.DataFrame(['sn', 'sulfuric acid', 'cu', 'sodium chloride', 'au'], columns=['Commodities'])
And I have another data frame containing the symbols of the chemical elements and their respective names. Like this:
| Name | Symbol |
|---|---|
| sn | tin |
| cu | copper |
| au | gold |
df2 = pd.DataFrame({'Name': ['tin', 'copper', 'gold'], 'Symbol': ['sn', 'cu', 'au']})
I need to replace the symbols (in the first dataframe)(df1['Commoditie']) with the names (in the second one) (df2['Names']), so that it outputs like the following:
I need the Output:
| Commoditie |
|---|
| tin |
| sulfuric acid |
| copper |
| sodium chloride |
| gold |
I tried using for loops and lambda but got different results than expected. I have tried many things and googled, I think it's something basic, but I just can't find an answer.
Thank you in advance!