I'm trying to get real prices for my data in pandas. Right now, I am just playing with one year's worth of data (3962050 rows) and it took me 443 seconds to inflate the values using the code below. Is there a quicker way to find the real value? Is it possible to use pooling? I have many more years and if would take too long to wait every time.
Portion of df:
    year    quarter fare
0   1994    1      213.98
1   1994    1      214.00   
2   1994    1      214.00
3   1994    1      214.50 
4   1994    1      214.50   
import cpi
import pandas as pd
def inflate_column(data, column):
    """
    Adjust for inflation the series of values in column of the   
    dataframe data. Using cpi library.
    """
    print('Beginning to inflate ' + column)
    start_time = time.time()
    
    df = data.apply(lambda x: cpi.inflate(x[column], 
                      x.year), axis=1)
    
    print("Inflating process took", time.time() - start_time, " seconds to run")  
    return df
df['real_fare'] = inflate_column(df, 'fare')