Skip to content

REF: tighten what we accept in TimedeltaIndex._simple_new #31315

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

Merged
merged 14 commits into from
Feb 9, 2020

Conversation

jbrockmendel
Copy link
Member

No description provided.

@@ -106,7 +106,9 @@ def test_resample_empty_series(freq, empty_series, resample_method):
if isinstance(s.index, PeriodIndex):
expected.index = s.index.asfreq(freq=freq)
else:
expected.index = s.index._shallow_copy(freq=freq)
idx = s.index
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as above, why not just collapse this so: s.index.asfreq(freq=freq) or s.copy()

we don't need to have the shallow copy used like this in tests, nor work-arounds like this.

Copy link
Member Author

Choose a reason for hiding this comment

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

implemented a helper _asfreq_compat for this, cleans up some code nicely

@jreback jreback added the Timedelta Timedelta data type label Jan 26, 2020
@jbrockmendel jbrockmendel added the Constructors Series/DataFrame/Index/pd.array Constructors label Jan 29, 2020


def _asfreq_compat(index, freq):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be in the indexes sub-tree?

Copy link
Member Author

Choose a reason for hiding this comment

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

if we start using it elsewhere then we can move it. as long as its just here, id prefer to keep it private

@jbrockmendel
Copy link
Member Author

gentle ping, id like to get this one in and move on to the PeriodArray and DTA counterparts

@jreback jreback added this to the 1.1 milestone Feb 9, 2020
@jreback jreback merged commit c988567 into pandas-dev:master Feb 9, 2020
@jreback
Copy link
Contributor

jreback commented Feb 9, 2020

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Constructors Series/DataFrame/Index/pd.array Constructors Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants