-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: Fix copy-pasted name in .day_name
docstring
#22544
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is pandas making the default English? Haven't looked in detail but assumed this would be system dependent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect that to be system independent (when programming, I'd rather have predictable results).
Code is implemented in
get_date_name_field()
:pandas/pandas/_libs/tslibs/fields.pyx
Lines 102 to 103 in 86e8f23
pandas/pandas/_libs/tslibs/fields.pyx
Lines 117 to 118 in 86e8f23
DAYS_FULL
andMONTHS_FULL
are hard-coded in Pandas:pandas/pandas/_libs/tslibs/ccalendar.pyx
Lines 39 to 48 in 86e8f23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was for
day_name
to replace the depreciatedweekday_name
which defaulted to hardcoded english names (without localization support).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree this should say the default is based on the locale
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback As you can see in the code snippets above, it is not based on the locale. The default is always English.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback I do not think the code I am running is relevant here. Unless you refer to a trivial example like the one I added in the docstring (but why would you need that?):
Can you explain why you still say the default when
locale=None
is based on the system's locale? I checked the tests, the code and the behavior and everything seems to prove otherwise: the default whenlocale=None
is English, and hence the proposed docstring. Did you check anything?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback If you tell me exactly what changes to the current docstring you have on your mind (it seems other reviewers are okay with it), I may better understand what you are saying. ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Peque @jreback The default locale is English as
day_name
is meant to replaceweekday_name
which defaulted to english. So the docstring here is correct.@Peque feel free to open up a new issue suggesting that
day_name
andmonth_name
should default to system locale. This would be an API change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mroeschke Yeah, but I do prefer the current behavior, so I would rather not open that issue (and note I am not a native English speaker nor live in an English country).
When programming, I prefer everything in English by default. 😜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha @Peque. I hold a similar opinion for API transition sake.
Therefore, I think there's no action with this docstring here as far as I'm concerned.