Skip to content

Conversation

@floura-angel
Copy link
Contributor

PR Summary

Bug in :meth:DataFrame.resample.asfreq where fixed-frequency indexes with origin ignored alignment
and returned incorrect values. Now origin and offset are respected. (:issue:62725)

@floura-angel floura-angel changed the title fix honor orgin in asfreq BUG: resample with asfreq ignores origin if the dataframe has a fixed frequency #62725 Oct 20, 2025
@floura-angel floura-angel marked this pull request as ready for review October 20, 2025 00:39
Comment on lines +1004 to +1010
exp_idx = pd.to_datetime(
[
"2025-10-17 17:15:00",
"2025-10-17 17:16:00",
"2025-10-17 17:17:00",
]
).astype(result.index.dtype) # match time unit (s/us/ns)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you construct a DatetimeIndex with freq= so we don't need to use check_freq=False?

@mroeschke mroeschke added Frequency DateOffsets Resample resample method labels Oct 20, 2025
tm.assert_frame_equal(result, expected)


def test_asfreq_respects_origin_with_fixed_freq_all_seconds_equal():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a comment to the test and refer to the issue related to it, something like # GH#62725 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frequency DateOffsets Resample resample method

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: resample with asfreq ignores origin if the dataframe has a fixed frequency

3 participants