-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update pandas.DatetimeIndex.to_period docstring(Nairobi) #20131
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
Changes from 2 commits
fb88d91
3ed30ec
c64779e
92c8a41
8fc1e9a
1ac618e
fa32bcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1057,7 +1057,30 @@ def to_pydatetime(self): | |
|
||
def to_period(self, freq=None): | ||
""" | ||
Cast to PeriodIndex at a particular frequency | ||
Cast to PeriodIndex at a particular frequency. | ||
|
||
Converts DatetimeIndex to periodIndex. | ||
|
||
Parameters | ||
---------- | ||
freq : string or pandas offset object, optional | ||
One of pandas date offset string or corresponding objects. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you include a link to the table of alias. Something like
|
||
|
||
Returns | ||
------- | ||
period: period[D] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
(need the space between the two). |
||
|
||
Examples | ||
-------- | ||
>>> df = pd.DataFrame({"y": [1,2,3]}, | ||
... index=pd.to_datetime(["2000-03-31 00:00:00", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make 'index' right below the |
||
... "2000-05-31 00:00:00", | ||
... "2000-08-31 00:00:00"])) | ||
>>> df.index = df.index.to_period("M") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And maybe just assign Then |
||
|
||
See also | ||
-------- | ||
Index: base pandas index type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove Index. Add pandas.PeriodIndex pandas.DatetimeIndex.to_pydatetime |
||
""" | ||
from pandas.core.indexes.period import PeriodIndex | ||
|
||
|
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.
extra space, can you capitalize PeriodIndex