Skip to content
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

DEPR: weekofyear #33503

Closed
mroeschke opened this issue Apr 12, 2020 · 3 comments · Fixed by #33595
Closed

DEPR: weekofyear #33503

mroeschke opened this issue Apr 12, 2020 · 3 comments · Fixed by #33595
Labels
Datetime Datetime data dtype Deprecate Functionality to remove in pandas
Milestone

Comments

@mroeschke
Copy link
Member

Now that isocalendar is available on Timestamp, DatetimeIndex and the dt accessor, weekofyear already exists in isocalendar and can be deprecated.

@mroeschke mroeschke added Deprecate Functionality to remove in pandas Datetime Datetime data dtype labels Apr 12, 2020
@jorisvandenbossche
Copy link
Member

Is such a deprecation needed?

Yes, it gives some duplication in functionality, but:

  • Those existing attributes have been around for a long time, and people have been happily using them.
  • Personally, I think weekofyear is more accessible (more logical to think of, easier findable with tab completion) than through isocalendar
  • isocalendar is also doing more work (and thus slower) if all you need is the week number

@mgmarino
Copy link
Contributor

mgmarino commented Apr 17, 2020

I'm ok with not deprecating, but I have a few comments:

  • Just because they're used a lot doesn't mean they're used correctly and I would argue that weekofyear could lead to a lot of hidden issues. That is, people don't realize that it's the ISO week and might not realize that year doesn't always match up with it. Indeed a quick search through the issues here yields a number of reported "bugs". By deprecating, it becomes harder to mess up: you would force people to actively choose the ISO calendar. Also, if they need a week with some other definition (starting on e.g. Sunday), then they can use the period functionality to do this.
  • Regarding slowness, if this is an issue than maybe it could be addressed some other way (e.g. caching).

@jreback
Copy link
Contributor

jreback commented Apr 17, 2020

perf is a non issue here

the only issue is cost of deprecation va correctness

eg realize that u r using iso

+1 on actually having an informative api

@jreback jreback added this to the 1.1 milestone May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants