Skip to content

REF: implement _with_freq, use _from_sequence less #32849

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 1 commit into from
Mar 22, 2020

Conversation

jbrockmendel
Copy link
Member

This makes method-chaining a little bit nicer.

Moving away from using _from_sequence and towards using the constructors where feasible. This will make it easier to stricten what we accept in these _from_sequence methods.

We also should be inferring freq less in arithmetic methods, but that is a behavior change that will be done separately.

@jreback jreback added Clean Frequency DateOffsets Refactor Internal refactoring of code and removed Clean labels Mar 21, 2020
@jreback jreback added this to the 1.1 milestone Mar 21, 2020
@@ -396,6 +396,34 @@ def floor(self, freq, ambiguous="raise", nonexistent="raise"):
def ceil(self, freq, ambiguous="raise", nonexistent="raise"):
return self._round(freq, RoundTo.PLUS_INFTY, ambiguous, nonexistent)

def _with_freq(self, freq):
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 type

Copy link
Contributor

Choose a reason for hiding this comment

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

Optional[Union[Dateoffset, str]]

Copy link
Contributor

Choose a reason for hiding this comment

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

returns Union[DTA,TDI,PA] (but I think we have a type for 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.

just tried this and it looks like its going to turn into a yak-shaving event, prefer to do that separately

Copy link
Contributor

Choose a reason for hiding this comment

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

kk, followup if you can

@jreback jreback merged commit d5a07a1 into pandas-dev:master Mar 22, 2020
@jreback
Copy link
Contributor

jreback commented Mar 22, 2020

thanks

SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
jbrockmendel added a commit to jbrockmendel/pandas that referenced this pull request Mar 23, 2020
@jbrockmendel jbrockmendel deleted the add_deltas-2 branch March 23, 2020 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frequency DateOffsets Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants