-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
EnhancementPerformanceMemory or execution speed performanceMemory or execution speed performanceWindowrolling, ewma, expandingrolling, ewma, expandingquantilequantile methodquantile method
Description
Currently, rolling_quantile() accepts only a single float for the quantile argument. I find myself wanting to compute multiple quantiles over the same data. Instead of doing three calls to rolling_quantile(), I'd like to be able to call rolling_quantile() once with a sequence of floats as the quantile argument and get back a list of results. This has benefits both in terms of code conciseness and efficiency.
This suggested behavior would be analogous to how np.percentile works. http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.percentile.html
Currently:
>>> import pandas as pd >>> ser = pd.Series(np.array([1,2,3,4,5,6,7,8,9])) >>> ser.rolling(window=3).quantile(quantile=0.5) 0 NaN 1 NaN 2 2 3 3 4 4 5 5 6 6 7 7 8 8 dtype: float64 Desired enhancement:
>>> ser.rolling(window=3).quantile(quantile=[0.25,0.5,1]) [0 NaN 1 NaN 2 1 3 2 4 3 5 4 6 5 7 6 8 7 dtype: float64, 0 NaN 1 NaN 2 2 3 3 4 4 5 5 6 6 7 7 8 8 dtype: float64, 0 NaN 1 NaN 2 3 3 4 4 5 5 6 6 7 7 8 8 9 dtype: float64] stharrold
Metadata
Metadata
Assignees
Labels
EnhancementPerformanceMemory or execution speed performanceMemory or execution speed performanceWindowrolling, ewma, expandingrolling, ewma, expandingquantilequantile methodquantile method