I am working on a data frame, which consists of the name of company, the ticker id, as well as the ticker exchange id. The code for scraping the data works fine. Below is the output of the data.
Company name (Company symbol, Company exchange)
0 Abbott Laboratories (ABT, NYQ)
1 ABBVIE (ABBV, NYQ)
2 ASML.AS (ASML.AS, AMS)
3 AD.AS (AD.AS, AMS)
Index(['Company name', ('Company symbol', 'Company exchange')], dtype='object')
type(df_companies)= pandas.core.frame.DataFrame
I have tried to strip the redundant symbols (), with codes like:
df[df_companies.columns] = df_companies.apply(lambda x: x.str.strip())
df_companies.applymap(lambda x: x.strip() if isinstance(x, str) else x)
These codes didn't work, they resulted in NaN. I tried to transpose the data frame, but that didn't help as well. The idea is to create the df_companies like this:
Company name Company symbol Company exchange
0 Abbott Laboratories ABT NYQ
1 ABBVIE ABBV NYQ
2 ASML.AS ASML.AS AMS
3 AD.AS AD.AS AMS
The final idea is to create a list per exchange, like this:
NYQ=['ABT', 'ABBV']
AMS=['ASMl.AS', 'AD.AS']
Any idea on how to solve this issue?

