Currently I am doing as below as I need to keep track of particular set of percentiles of expanding set of values.
I was wondering if there is more optimized way to do this using any numpy vectorization tricks
import numpy as np
import pandas as pd
a=np.random.rand(1000)
df=pd.DataFrame(a,columns=['Data'])
val=25
df['25th_Perc']=df.expanding(min_periods=1).apply(lambda x:np.nanpercentile(x,val,interpolation='nearest'),raw=True)