Skip to content

Fix Issues with FY5253 and nearest w/ year end in Dec #5405

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 2 commits into from
Nov 7, 2013

Conversation

cancan101
Copy link
Contributor

There are currently some issues with FY5253 working with variation="nearest" and startingMonth=12.

This PR fixes those issues and add some more tests.


def apply(self, other):
n = self.n
daten1 = self.get_year_end(datetime(other.year-1, self.startingMonth,1))
date0 = self.get_year_end(datetime(other.year, self.startingMonth,1))
date1 = self.get_year_end(datetime(other.year+1, self.startingMonth,1))
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe clearer if prev_year, cur_year, next_year

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

On Fri, Nov 1, 2013 at 12:18 AM, Jeff Tratner [email protected]:

In pandas/tseries/offsets.py:

 def apply(self, other):
     n = self.n
  •    daten1 = self.get_year_end(datetime(other.year-1, self.startingMonth,1))
    
  •    date0 = self.get_year_end(datetime(other.year, self.startingMonth,1))
    
  •    date1 = self.get_year_end(datetime(other.year+1, self.startingMonth,1))
    

maybe clearer if prev_year, cur_year, next_year


Reply to this email directly or view it on GitHubhttps://github.com//pull/5405/files#r7363235
.

@cancan101
Copy link
Contributor Author

@jtratner Other than that, any other changes? I would like to get this fix merged in for v13

@jtratner
Copy link
Contributor

jtratner commented Nov 1, 2013

Need to rebase.

@cancan101
Copy link
Contributor Author

Of course

@jtratner
Copy link
Contributor

jtratner commented Nov 1, 2013

it just was not mergeable. If you make that change for clarity and pinky-swear that it's doing what it's supposed to, I'm sure it's fine (you're sort of the expert on the retail year). 😄 I'll give it another once over after you change the naming there.

@cancan101
Copy link
Contributor Author

I am becoming the expert. The problem was I was previously using the "year" of the dt as the canonical FY year. Unfortunately there are circumstances where two years end in the same calendar year.

@cancan101
Copy link
Contributor Author

@jtratner Okay rebased, etc.

@jtratner
Copy link
Contributor

jtratner commented Nov 2, 2013

I know we don't always ask this, but can you fix up your formatting? Just run a pep8 linter and then make changes to your portion of the code. Especially spaces around operators.

@cancan101
Copy link
Contributor Author

@jtratner Should be PEP8 compliant. I also moved the new classes around as mentioned previously.

@cancan101
Copy link
Contributor Author

@jtratner What do you think of the code?

@jtratner
Copy link
Contributor

jtratner commented Nov 4, 2013

I hate to ask this (and it's okay if you can't), but is there any way you could split this into two commits? (one that does the code move through the file and one that makes the changes). It's hard to tell which changes are what.

@cancan101
Copy link
Contributor Author

I'm sure a little copy and paste action will solve this; the move was relatively simple. Let me give it a shot . One day diff tools will handle situations like this.

@jtratner
Copy link
Contributor

jtratner commented Nov 4, 2013

or maybe even save you from overzealous devs asking you to squash your commits 😝

@cancan101
Copy link
Contributor Author

@jtratner Commit split

jtratner added a commit that referenced this pull request Nov 7, 2013
Fix Issues with FY5253 and nearest w/ year end in Dec
@jtratner jtratner merged commit 5ca923d into pandas-dev:master Nov 7, 2013
@jtratner
Copy link
Contributor

jtratner commented Nov 7, 2013

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants