I have two dataframes I am comparing, I am looking at the columns from the two and seeing if the two have an exact string match between them. If they do I have string I want to copy into a new column on the first dataframe. When I do merge it is making my first dataframe longer because it is copying rows. I believe I need a function to scan through each row and look if there is a string match and make a new row on my df_1
df_1 = pd.DataFrame({'ShipName': ['D', 'A', 'C']})
df_2 = pd.DataFrame({'ShipName': ['A', 'B', 'C', 'D',], 'ShipKey' = ['First', 'Second', 'Third', 'Fourth']}
end result to look like this because I compared the two dataframes and I found the ShipName that matched and looked at the corresponding key to see what value I should copy into my df_1
df_1 = pd.DataFrame({'ShipName': ['D', 'A', 'C'], 'ShipKey_Matched': ['Fourth', 'First', 'Third']})