Skip to content

"approximate" datetime reindexing #841

Closed
@adamklein

Description

@adamklein

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    AlgosNon-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diffDatetimeDatetime data dtypeEnhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions