I have dataframe of stocks and another dataframe of stocks with company name and ticker:
#df1
Company_name Industry
Buckle Inc. (The) Retail
TILLY'S INC Apparel
Teck Resources Ltd Mining
#df2
Company_name Ticker
Buckle Inc BKE
TILLY'S, INC. TLYS
Teck Resources Ltd TECK
I want to add tickers (from df2) to each company name in df1.
The problem is company names is sometime different, for example:
Buckle Inc. (The) and Buckle Inc but they always share some substring.
I try merge but only work when 2 company names are 100% the same, like Teck Resources Ltd in my example.
# I tried this:
df.merge(df1, on='Company_name', how='left')
#return :
Company_name Industry Ticker
Teck Resources Ltd Mining TECK
This is the output I need:
Company_name Industry Ticker
Buckle Inc. (The) Retail BKE
Tilly's Inc. Apparel TLYS
Teck Resources Ltd Mining TECK