-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Enhanced the documentation and added examples in pandas tseries offsets Week class #50732
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 10 commits
f8c5d5d
6c8648b
4f23831
b1c6110
de464ec
9a493e9
7e3afa3
e99a1ec
9eb2f2e
f68b9f8
02f7fda
0ea315d
e7282a7
17d8965
40a2882
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 |
---|---|---|
|
@@ -2778,17 +2778,33 @@ cdef class SemiMonthBegin(SemiMonthOffset): | |
cdef class Week(SingleConstructorOffset): | ||
""" | ||
Weekly offset. | ||
|
||
Parameters | ||
---------- | ||
weekday : int or None, default None | ||
Always generate specific day of week. 0 for Monday. | ||
Always generate specific day of week. 0 for Monday and 6 for Sunday. | ||
|
||
Examples | ||
See Also | ||
-------- | ||
>>> ts = pd.Timestamp(2022, 1, 1) | ||
>>> ts + pd.offsets.Week() | ||
Timestamp('2022-01-08 00:00:00') | ||
pd.tseries.offsets.WeekOfMonth : Describes monthly dates like "the Tuesday of the 2nd week of each month". | ||
|
||
Examples | ||
--------- | ||
Comment on lines
+2794
to
+2795
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. just noticed, I think the underscores need to be the same length as the title could you please also build this docstring locally and screenshot it and check it looks alright? 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.
Hi @MarcoGorelli, it looks like this. It looks fine to me :D but should i add one more commit?
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. that's not the rendered docstring, see https://pandas.pydata.org/docs/dev/development/contributing_documentation.html#building-the-documentation for how to build it something like cd doc
python make.py clean && python make.py --single pandas.tseries.offsets.Week 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.
Hey @MarcoGorelli , this is the rendered docstring, does this work?
|
||
|
||
>>> date_object = pd.Timestamp("2023-01-13") | ||
>>> date_object | ||
2023-01-13 00:00:00 | ||
|
||
>>> date_plus_one_week = date_object + pd.tseries.offsets.Week(n=1) | ||
>>> date_plus_one_week | ||
2023-01-20 00:00:00 | ||
|
||
>>> date_next_monday = date_object + pd.tseries.offsets.Week(weekday=0) | ||
>>> date_next_monday | ||
2023-01-16 00:00:00 | ||
|
||
>>> date_next_sunday = date_object + pd.tseries.offsets.Week(weekday=6) | ||
>>> date_next_sunday | ||
2023-01-15 00:00:00 | ||
""" | ||
|
||
_inc = timedelta(weeks=1) | ||
|
Uh oh!
There was an error while loading. Please reload this page.