If you're happy to add some types you might also get some speed ups using mypyc. Another option might be to switch your dicts to pandas series; you might be iterating over several lookups in python and with pandas you might be able to switch those into functions written and compiled in C.