Fetching a company’s NAICS codes¶
Show code cell content
import refinitiv.data as rd
rd.open_session()
/home/runner/.local/share/virtualenvs/refinitiv-data-python-cookbook-I-HIyNf4/lib/python3.10/site-packages/refinitiv/data/_access_layer/session.py:71:FutureWarning:
You open a platform session using the default value of the signon_control parameter (signon_control=True).
In future library version v2.0, this default will be changed to False.
If you want to keep the same behavior as today, you will need to set the signon_control parameter to True either in the library configuration file
({'sessions':{'platform':{'your_session_name':{'signon_control':true}}}}) or in your code where you create the Platform Session.
These alternative options are already supported in the current version of the library.
<refinitiv.data.session.Definition object at 0x7fcfe49257e0 {name='rdp'}>
You can use the Refinitiv Data Library for Python to retrieve the North American Industry Classification System (NAICS) codes associated with a company. It is a standard used by US statistical agencies to classify business establishments for economic analysis.
To do acquire the data, pass a company’s Refinitiv Instrument Code to the get_data
method with a request for NAICS related fields.
Here’s a query for Thomson Reuters:
rd.get_data(
'TRI.N',
fields=[
# Basic stuff
"TR.CommonName",
"TR.TickerSymbol",
# NAICS codes
"TR.NAICSSectorCode",
"TR.NAICSSector",
"TR.NAICSSubsectorCode",
"TR.NAICSSubsector",
"TR.NAICSIndustryGroupCode",
"TR.NAICSIndustryGroup",
"TR.NAICSIndustryCode",
"TR.NAICSIndustry",
"TR.NAICSActivityCode",
"TR.NAICSActivity",
]
)
Instrument | Company Common Name | Ticker Symbol | NAICS Sector Code | NAICS Sector Name | NAICS Subsector Code | NAICS Subsector Name | NAICS Industry Group Code | NAICS Industry Group Name | |
---|---|---|---|---|---|---|---|---|---|
0 | TRI.N | Thomson Reuters Corp | TRI | 51 | Information | 518 | Computing Infrastructure Providers, Data Proce... | 5182 | Computing Infrastructure Providers, Data Proce... |
Show code cell content
rd.close_session()