Industry the company associated with
rajanprabu opened this issue · 2 comments
Hi JerBouma,
Thanks for this wonderful package. Very useful resource indeed. I was wondering is it possible to provide symbol of a company ans fish out the industry/sector that its associated with ? Some companies have mix of products that it woule be listed in two different Industry. It would be useful to get the associated industry given the symbol. Thanks
Hi Rajan,
The database will always be based on one classification which they are the most closely related to. You could say Amazon is in a lot of industries as they provide so many different products. However, their core business is being an online marketplace therefore the industry is titled "Internet Retail".
Your request can be achieved with the following code:
import financedatabase as fd
equities = fd.select_equities()
symbol_industry = {}
for symbol, values in equities.items():
symbol_industry[symbol] = values['industry']
In a neat format (DataFrame):
df = pd.DataFrame.from_dict(symbol_industry, orient='index', columns=['Industry'])
Out[11]:
Industry
None
A Diagnostics & Research
AA Aluminum
AAALF
AAALY None
...
ZYXI Medical Devices
ZZHGF Insurance - Property & Casualty
ZZHGY None
ZZLL Internet Content & Information
ZZZOF Other Industrial Metals & Mining
[20063 rows x 1 columns]
Thank you so much JerBouma. Appreciate the answer.