Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Best way to get industry names from their codes?

Say if I got a list of industry codes: Fundamentals.morningstar_industry_code, how do I quickly get the Industry names from them? I know that there is a table to look up to from here: https://www.quantopian.com/help/fundamentals#industry-sector but I do I reference that table from my code?

2 responses

So I went on and manually wrote the industry names:

industry_names = {  
    10101001: 'Agricultural Inputs',  
    10102002: 'Building Materials',  
    10103003: 'Chemicals',  
    10103004: 'Specialty Chemicals',  
    10104005: 'Coal',  
    10105006: 'Lumber & Wood Production',  
    10105007: 'Paper & Paper Products',  
    10106008: 'Aluminum',  
    10106009: 'Copper',  
    10106010: 'Gold',  
    10106011: 'Industrial Metals & Minerals',  
    10106012: 'Silver',  
    10107013: 'Steel',  
    10208014: 'Advertising Agencies',  
    10208015: 'Marketing Services',  
    10209016: 'Auto & Truck Dealerships',  
    10209017: 'Auto Manufacturers',  
    10209018: 'Auto Parts',  
    10209019: 'Recreational Vehicles',  
    10209020: 'Rubber & Plastics',  
    10210021: 'Broadcasting - Radio',  
    10210022: 'Broadcasting - TV',  
    10210023: 'Media - Diversified',  
    10211024: 'Residential Construction',  
    10211025: 'Textile Manufacturing',  
    10212026: 'Apparel Manufacturing',  
    10212027: 'Footwear & Accessories',  
    10212028: 'Home Furnishings & Fixtures',  
    10213029: 'Packaging & Containers',  
    10214030: 'Personal Services',  
    10215031: 'Publishing',  
    10216032: 'Restaurants',  
    10217033: 'Apparel Stores',  
    10217034: 'Department Stores',  
    10217035: 'Home Improvement Stores',  
    10217036: 'Luxury Goods',  
    10217037: 'Specialty Retail',  
    10218038: 'Gambling',  
    10218039: 'Leisure',  
    10218040: 'Lodging',  
    10218041: 'Resorts & Casinos',  
    10319042: 'Asset Management',  
    10320052: 'Specialty Finance',  
    10321053: 'Capital Markets',  
    10321054: 'Financial Exchanges',  
    10321055: 'Insurance Brokers',  
    10322056: 'Credit Services',  
    10323057: 'Insurance - Diversified',  
    10324058: 'Insurance - Life',  
    10325059: 'Insurance - Property & Casualty',  
    10326060: 'Insurance - Reinsurance',  
    10326061: 'Insurance - Specialty',  
    10427062: 'Real Estate - General',  
    10427063: 'Real Estate - Services',  
    10428064: 'REIT - Diversified',  
    10428065: 'REIT - Healthcare Facilities',  
    10428066: 'REIT - Hotel & Motel',  
    10428067: 'REIT - Industrial',  
    10428068: 'REIT - Office',  
    10428069: 'REIT - Residential',  
    10428070: 'REIT - Retail',  
    20529071: 'Beverages - Brewers',  
    20529072: 'Beverages - Wineries & Distilleries',  
    20530073: 'Beverages - Soft Drinks',  
    20531074: 'Confectioners',  
    20531075: 'Farm Products',  
    20531076: 'Household & Personal Products',  
    20531077: 'Packaged Foods',  
    20532078: 'Education & Training Services',  
    20533079: 'Discount Stores',  
    20533080: 'Pharmaceutical Retailers',  
    20533081: 'Food Distribution',  
    20533082: 'Grocery Stores',  
    20534083: 'Tobacco',  
    20635084: 'Biotechnology',  
    20636085: 'Drug Manufacturers - Major',  
    20636086: 'Drug Manufacturers - Specialty & Generic',  
    20637087: 'Health Care Plans',  
    20638088: 'Long-Term Care Facilities',  
    20638089: 'Medical Care',  
    20639090: 'Medical Devices',  
    20640091: 'Diagnostics & Research',  
    20641092: 'Medical Distribution',  
    20642093: 'Medical Instruments & Supplies',  
    20743094: 'Utilities - Independent Power Producers',  
    20744095: 'Utilities - Diversified',  
    20744096: 'Utilities - Regulated Electric',  
    20744097: 'Utilities - Regulated Gas',  
    20744098: 'Utilities - Regulated Water',  
    30845099: 'Pay TV',  
    30845100: 'Telecom Services',  
    30946101: 'Oil & Gas Drilling',  
    30947102: 'Oil & Gas E&P',  
    30948103: 'Oil & Gas Integrated',  
    30949104: 'Oil & Gas Midstream',  
    30950105: 'Oil & Gas Refining & Marketing',  
    30951106: 'Oil & Gas Equipment & Services',  
    31052107: 'Aerospace & Defense',  
    31053108: 'Airlines',  
    31054109: 'Business Services',  
    31056111: 'Rental & Leasing Services',  
    31056112: 'Security & Protection Services',  
    31057113: 'Staffing & Outsourcing Services',  
    31058114: 'Engineering & Construction',  
    31059116: 'Farm & Construction Equipment',  
    31060117: 'Industrial Distribution',  
    31061118: 'Business Equipment',  
    31061119: 'Diversified Industrials',  
    31061120: 'Metal Fabrication',  
    31061121: 'Pollution & Treatment Controls',  
    31061122: 'Tools & Accessories',  
    31062123: 'Airports & Air Services',  
    31062124: 'Integrated Shipping & Logistics',  
    31062125: 'Railroads',  
    31062126: 'Shipping & Ports',  
    31062127: 'Trucking',  
    31063128: 'Truck Manufacturing',  
    31064129: 'Waste Management',  
    31165130: 'Electronic Gaming & Multimedia',  
    31165131: 'Health Information Services',  
    31165132: 'Information Technology Services',  
    31165133: 'Software - Application',  
    31165134: 'Software - Infrastructure',  
    31166135: 'Communication Equipment',  
    31167136: 'Computer Distribution',  
    31167137: 'Computer Systems',  
    31167138: 'Consumer Electronics',  
    31167139: 'Contract Manufacturers',  
    31167140: 'Data Storage',  
    31167141: 'Electronic Components',  
    31167142: 'Electronics Distribution',  
    31167143: 'Scientific & Technical Instruments',  
    31168144: 'Internet Content & Information',  
    31169145: 'Semiconductor Equipment & Materials',  
    31169146: 'Semiconductor Memory',  
    31169147: 'Semiconductors',  
    31169148: 'Solar',  
}

It is not a complete list as I took only the IDs that are relevant to my current research.

Industry names post November 2019:

industry_names_post_Nov2019 = {  
    10110010: 'Agricultural Inputs',  
    10120010: 'Building Materials',  
    10130010: 'Chemicals',  
    10130020: 'Specialty Chemicals',  
    10140010: 'Lumber & Wood Production',  
    10140020: 'Paper & Paper Products',  
    10150010: 'Aluminum',  
    10150020: 'Copper',  
    10150030: 'Other Industrial Metals & Mining',  
    10150040: 'Gold',  
    10150050: 'Silver',  
    10150060: 'Other Precious Metals & Mining',  
    10160010: 'Coking Coal',  
    10160020: 'Steel',  
    10200010: 'Auto & Truck Dealerships',  
    10200020: 'Auto Manufacturers',  
    10200030: 'Auto Parts',  
    10200040: 'Recreational Vehicles',  
    10220010: 'Furnishings, Fixtures & Appliances',  
    10230010: 'Residential Construction',  
    10240010: 'Textile Manufacturing',  
    10240020: 'Apparel Manufacturing',  
    10240030: 'Footwear & Accessories',  
    10250010: 'Packaging & Containers',  
    10260010: 'Personal Services',  
    10270010: 'Restaurants',  
    10280010: 'Apparel Retail',  
    10280020: 'Department Stores',  
    10280030: 'Home Improvement Retail',  
    10280040: 'Luxury Goods',  
    10280050: 'Internet Retail',  
    10280060: 'Specialty Retail',  
    10290010: 'Gambling',  
    10290020: 'Leisure',  
    10290030: 'Lodging',  
    10290040: 'Resorts & Casinos',  
    10290050: 'Travel Services',  
    10310010: 'Asset Management',  
    10320010: 'Banks—Diversified',  
    10320020: 'Banks—Regional',  
    10320030: 'Mortgage Finance',  
    10330010: 'Capital Markets',  
    10330020: 'Financial Data & Stock Exchanges',  
    10340010: 'Insurance—Life',  
    10340020: 'Insurance—Property & Casualty',  
    10340030: 'Insurance—Reinsurance',  
    10340040: 'Insurance—Specialty',  
    10340050: 'Insurance Brokers',  
    10340060: 'Insurance—Diversified',  
    10350010: 'Shell Companies',  
    10350020: 'Financial Conglomerates',  
    10360010: 'Credit Services',  
    10410010: 'Real Estate—Development',  
    10410020: 'Real Estate Services',  
    10410030: 'Real Estate—Diversified',  
    10420010: 'REIT—Healthcare Facilities',  
    10420020: 'REIT—Hotel & Motel',  
    10420030: 'REIT—Industrial',  
    10420040: 'REIT—Office',  
    10420050: 'REIT—Residential',  
    10420060: 'REIT—Retail',  
    10420070: 'REIT—Mortgage',  
    10420080: 'REIT—Specialty',  
    10420090: 'REIT—Diversified',  
    20510010: 'Beverages—Brewers',  
    20510020: 'Beverages—Wineries & Distilleries',  
    20520010: 'Beverages—Non-Alcoholic',  
    20525010: 'Confectioners',  
    20525020: 'Farm Products',  
    20525030: 'Household & Personal Products',  
    20525040: 'Packaged Foods',  
    20540010: 'Education & Training Services',  
    20550010: 'Discount Stores',  
    20550020: 'Food Distribution',  
    20550030: 'Grocery Stores',  
    20560010: 'Tobacco',  
    20610010: 'Biotechnology',  
    20620010: 'Drug Manufacturers—General',  
    20620020: 'Drug Manufacturers—Specialty & Generic',  
    20630010: 'Healthcare Plans',  
    20645010: 'Medical Care Facilities',  
    20645020: 'Pharmaceutical Retailers',  
    20645030: 'Health Information Services',  
    20650010: 'Medical Devices',  
    20650020: 'Medical Instruments & Supplies',  
    20660010: 'Diagnostics & Research',  
    20670010: 'Medical Distribution',  
    20710010: 'Utilities—Independent Power Producers',  
    20710020: 'Utilities—Renewable',  
    20720010: 'Utilities—Regulated Water',  
    20720020: 'Utilities—Regulated Electric',  
    20720030: 'Utilities—Regulated Gas',  
    20720040: 'Utilities—Diversified',  
    30810010: 'Telecom Services',  
    30820010: 'Advertising Agencies',  
    30820020: 'Publishing',  
    30820030: 'Broadcasting',  
    30820040: 'Entertainment',  
    30830010: 'Internet Content & Information',  
    30830020: 'Electronic Gaming & Multimedia',  
    30910010: 'Oil & Gas Drilling',  
    30910020: 'Oil & Gas E&P',  
    30910030: 'Oil & Gas Integrated',  
    30910040: 'Oil & Gas Midstream',  
    30910050: 'Oil & Gas Refining & Marketing',  
    30910060: 'Oil & Gas Equipment & Services',  
    30920010: 'Thermal Coal',  
    30920020: 'Uranium',  
    31010010: 'Aerospace & Defense',  
    31020010: 'Specialty Business Services',  
    31020020: 'Consulting Services',  
    31020030: 'Rental & Leasing Services',  
    31020040: 'Security & Protection Services',  
    31020050: 'Staffing & Employment Services',  
    31030010: 'Conglomerates',  
    31040010: 'Engineering & Construction',  
    31040020: 'Infrastructure Operations',  
    31040030: 'Building Products & Equipment',  
    31050010: 'Farm & Heavy Construction Machinery',  
    31060010: 'Industrial Distribution',  
    31070010: 'Business Equipment & Supplies',  
    31070020: 'Specialty Industrial Machinery',  
    31070030: 'Metal Fabrication',  
    31070040: 'Pollution & Treatment Controls',  
    31070050: 'Tools & Accessories',  
    31070060: 'Electrical Equipment & Parts',  
    31080010: 'Airports & Air Services',  
    31080020: 'Airlines',  
    31080030: 'Railroads',  
    31080040: 'Marine Shipping',  
    31080050: 'Trucking',  
    31080060: 'Integrated Freight & Logistics',  
    31090010: 'Waste Management',  
    31110010: 'Information Technology Services',  
    31110020: 'Software—Application',  
    31110030: 'Software—Infrastructure',  
    31120010: 'Communication Equipment',  
    31120020: 'Computer Hardware',  
    31120030: 'Consumer Electronics',  
    31120040: 'Electronic Components',  
    31120050: 'Electronics & Computer Distribution',  
    31120060: 'Scientific & Technical Instruments',  
    31130010: 'Semiconductor Equipment & Materials',  
    31130020: 'Semiconductors',  
    31130030: 'Solar'  
}