Skip to content

Upsampling a time-series is missing an option to properly deal with the end #10449

Open
@filmor

Description

@filmor

Consider the following:

index = pd.date_range("2015-01-01", "2015-01-01 02:00", freq="1H", closed="left")
s = pd.Series(1, index=index)
s.resample("15T", fill_method="ffill", closed="left")

The result looks like this

2015-01-01 00:00:00    1
2015-01-01 00:15:00    1
2015-01-01 00:30:00    1
2015-01-01 00:45:00    1
2015-01-01 01:00:00    1
Freq: 15T, dtype: int64

What I actually want is

2015-01-01 00:00:00    1
2015-01-01 00:15:00    1
2015-01-01 00:30:00    1
2015-01-01 00:45:00    1
2015-01-01 01:00:00    1
2015-01-01 01:15:00    1
2015-01-01 01:30:00    1
2015-01-01 01:45:00    1
Freq: 15T, dtype: int64

Currently it seems that you always have to do the resampling yourself by creating a new index of the new frequency from the same begin and end values, reindexing, and forward filling.

Actually, I would have expected closed to work like this. Any hints on a reasonable parameter so I can try to prepare a PR for this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions