-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: pd.Period and pd.period_range should document that they accept datetime, date and pd.Timestamp #53632
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: pd.Period and pd.period_range should document that they accept datetime, date and pd.Timestamp #53632
Conversation
@mroeschke I opened this PR to follow up on #53611 in addressing #53038. I realised I didn't push one last commit to the previous PR and the additional accepted types were missing from the I didn't open a new issue since this still addresses the previous one, but let me know if this is not the right course of action. Thanks and sorry! |
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.
thanks for your PR - just got a question
pandas/_libs/tslibs/period.pyx
Outdated
@@ -2663,6 +2663,7 @@ class Period(_Period): | |||
One of pandas period strings or corresponding objects. Accepted | |||
strings are listed in the | |||
:ref:`offset alias section <timeseries.offset_aliases>` in the user docs. | |||
If value is not already period-like, freq is required. |
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.
are you sure this is true? e.g. here I don't specify freq
In [1]: pd.Period('2020-01')
Out[1]: Period('2020-01', 'M')
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.
@MarcoGorelli thanks. Good point, it works with a string, it just errors if value is None or datetime. Changed the note to reflect that.
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.
thanks - looks fine for None
though?
In [3]: pd.Period(None)
Out[3]: NaT
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.
hi - is this still active? if so, could you address this comment please?
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.
Sorry, missed this comment. I believe it should be all set now
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.
thanks @ABizzinotto
…atetime, date and pd.Timestamp (pandas-dev#53632) * Update docstrings for pandas.Period and period_range * Fix Period docstring comment * Fix Period value docstring
NOTE: This is a follow up to PR #53611 as I realised the issue was incompletely addressed there
pd.Period
andpd.period_range
should document that they acceptdatetime
,date
andpd.Timestamp
#53038 (Replace xxxx with the GitHub issue number)doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.