Skip to content

API: joining DatetimeIndexes not preserving freq #32157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jbrockmendel opened this issue Feb 21, 2020 · 2 comments · Fixed by #32166
Closed

API: joining DatetimeIndexes not preserving freq #32157

jbrockmendel opened this issue Feb 21, 2020 · 2 comments · Fixed by #32166
Labels
Datetime Datetime data dtype
Milestone

Comments

@jbrockmendel
Copy link
Member

dti = pd.date_range('2016-01-01', periods=10)
left, right = dti[:5], dti[5:]
joined = left.join(right, how="outer")

In master joined.freq comes back as None, while in 0.25.3 it was "D". There is some code in DatetimeIndex._wrap_joined_index that suggests to me this was intentional.

Can someone confirm this suspicion cc @jorisvandenbossche ? If so, I've got a branch that restores the old behavior, just need to add tests.

@gfyoung gfyoung added Regression Functionality that used to work in a prior pandas version Datetime Datetime data dtype labels Feb 22, 2020
@jreback jreback added this to the 1.1 milestone Feb 22, 2020
@jbrockmendel jbrockmendel changed the title API/REGR: joining DatetimeIndexes not preserving freq API: joining DatetimeIndexes not preserving freq Feb 22, 2020
@jbrockmendel jbrockmendel removed the Regression Functionality that used to work in a prior pandas version label Feb 22, 2020
@jorisvandenbossche jorisvandenbossche modified the milestones: 1.1, 1.0.2 Feb 24, 2020
@jorisvandenbossche
Copy link
Member

There is some code in DatetimeIndex._wrap_joined_index that suggests to me this was intentional.

Do you mean it was intentionally preserving the freq, or that it was an intentional change in 1.0 to no longer preserve this?

@jbrockmendel
Copy link
Member Author

Do you mean it was intentionally preserving the freq, or that it was an intentional change in 1.0 to no longer preserve this?

_wrap_joined_index looks like it was written to intentionally preserve the freq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants