"approximate" datetime reindexing #841
Labels
Algos
Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
Datetime
Datetime data dtype
Enhancement
From the mailing list:
It would be nice to have a general, useful algorithm for doing
"approximate" reindexing like you describe. I'm thinking:
def approx_resample(obj, base, multiple, tolerance, offset=0, mode='nearest'):
...
then you would do:
result = approx_resample(df, 'min', 15, 5)
obviously
'min' <=> Minute()
offset would enable you to do like 1, 16, 31, 46 (offset=1) instead of
0, 15, 30, 45
mode parameter would allow you to do other things-- nearest, first,
last, mean of values, or some kind of interpolation method, etc.
to reflect the fact that you don't have some times you would just
dropna in the result-- could make the algo a bit smarter and only
generate dates that are within the tolerance of observed dates
(according to the frequency multiple)
The text was updated successfully, but these errors were encountered: