-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add notes about M and Y to to_timedelata documentation. (#34968) #34979
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
DOC: Add notes about M and Y to to_timedelata documentation. (#34968) #34979
Conversation
pandas/core/tools/timedeltas.py
Outdated
The data to be converted to timedelta. Note that the character M | ||
is treated as minute, not month. The characters Y and y are treated | ||
as the mean length of the Gregorian calendar year - 365.2425 days or | ||
365 days 5 hours 49 minutes 12 seconds |
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.
365 days 5 hours 49 minutes 12 seconds | |
365 days 5 hours 49 minutes 12 seconds. |
Can you also link to the relevant issue in the description? |
Since MS is valid for milliseconds and contains the character M my PR should probably be changed to something like
|
Makes sense to me - do you want to push such an update? |
I think I updated it correctly ( https://xkcd.com/1597/ ). If not, please let me know what I should have done to update the PR. Thanks. |
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.
Pending green, this looks correct to me
Does this close #34968? If not, can you suggest what needs to be done there? |
Yes, I believe documenting the current behavior addresses the issue. Thanks. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
>>> (pd.Timestamp.today() + pd.to_timedelta('1 Y')) - pd.Timestamp.today()
Timedelta('365 days 05:49:11.999916')
>>> (pd.Timestamp.today() + pd.to_timedelta('1 M')) - pd.Timestamp.today()
Timedelta('0 days 00:00:59.999766') Looks right to me...thanks @selasley ! |
hmm this added note is very misleading then if the above is true then pls revert this |
i c pls create a new issue to deprecate these as strings as well we do not support these as they are very confusing yes they work but they are fixed offsets and almost never what you want |
sure, done - #36666 |
…dev#34968) (pandas-dev#34979) * DOC: Add notes about M and Y to to_timedelata documentation. (pandas-dev#34968) * DOC: Update notes about M and Y to to_timedelata documentation. (pandas-dev#34968) * DOC: Add notes about M and Y to to_timedelata documentation. (pandas-dev#34968)
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Not sure it closes these issues, but using "M" in the arg argument of to_timedelta caused confusion in #34968 and #27285. #33094 is somewhat related. I came across another issue I can't find now where there was confusion about "Y" returning a days with times delta