Skip to content

BUG: Why is resampling with rule='7d' different than resampling with rule='168h'? #44996

Open
@mkp-gebensleben

Description

@mkp-gebensleben

Research

  • I have searched the [pandas] tag on StackOverflow for similar questions.

  • I have asked my usage related question on StackOverflow.

Link to question on StackOverflow

https://stackoverflow.com/questions/70436514/timestamp-binning-mechanics-when-resampling

Question about pandas

>>> df = pd.DataFrame(index=pd.date_range(start='2021-04-21 01:00:00', end='2021-04-28 01:00', freq='1d'), data=[1]*8)
>>> df.resample(rule='7d', origin='2021-04-29 00:00:00', closed='right', label='right').sum()
            0
2021-04-22  2
2021-04-29  6
>>> df.resample(rule='168h', origin='2021-04-29 00:00:00', closed='right', label='right').sum()
            0
2021-04-22  1
2021-04-29  7
  1. Why does this happen?
  2. Should this happen?

Using pandas 1.3.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions