Python code to read the industry definitions files from Ken French's Data Library and return a dictionary that maps from SIC code to Fama-French industry code.
To install, run this in a terminal:
pip install git+https://github.com/stoffprof/ff_industries.gitTo use the mapping in Python, do:
import ff_industries
ff_map = ff_industries.get_sic_map(num_ports)where num_ports is the number of industry portfolios you want.