Python - Speed up for converting a categorical variable to it's numerical index,df['col'] = df['col'].astype('category')