-
-
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 1 commit
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 |
---|---|---|
|
@@ -2490,13 +2490,36 @@ cdef class SemiMonthBegin(SemiMonthOffset): | |
|
||
cdef class Week(SingleConstructorOffset): | ||
""" | ||
Weekly offset. | ||
Weekly offset. | ||
|
||
akshay-babbar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Parameters | ||
---------- | ||
weekday : int or None, default None | ||
Always generate specific day of week. 0 for Monday. | ||
""" | ||
Parameters | ||
---------- | ||
weekday : int or None, default None | ||
Always generate specific day of week. 0 for Monday and 6 for Sunday. | ||
|
||
Examples | ||
--------- | ||
## Below examples explain the usage of this object. | ||
## Importing modules | ||
import pandas as pd | ||
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. I don't think this is necessary, can you try without? |
||
|
||
date_format = "%Y-%m-%d" | ||
date_object = pd.to_datetime("2023-01-13",format = date_format) | ||
print(date_object) | ||
## 2023-01-13 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. this isn't how we write examples, please check https://pandas.pydata.org/docs/development/contributing_docstring.html |
||
|
||
date_plus_one_week = date_object + pd.tseries.offsets.Week(1) | ||
print(date_plus_one_week) | ||
#2023-01-20 00:00:00 | ||
|
||
date_next_Monday = date_object + pd.tseries.offsets.Week(weekday=0) | ||
print(date_next_Monday) | ||
#2023-01-16 00:00:00 | ||
|
||
date_next_Sunday = date_object + pd.tseries.offsets.Week(weekday=6) | ||
print(date_next_Sunday) | ||
#2023-01-15 00:00:00 | ||
""" | ||
|
||
_inc = timedelta(weeks=1) | ||
_prefix = "W" | ||
|
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.
please don't change the indendation