File tree Expand file tree Collapse file tree 1 file changed +29
-6
lines changed Expand file tree Collapse file tree 1 file changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -2490,13 +2490,36 @@ cdef class SemiMonthBegin(SemiMonthOffset):
2490
2490
2491
2491
cdef class Week(SingleConstructorOffset):
2492
2492
"""
2493
- Weekly offset.
2493
+ Weekly offset.
2494
2494
2495
- Parameters
2496
- ----------
2497
- weekday : int or None, default None
2498
- Always generate specific day of week. 0 for Monday.
2499
- """
2495
+ Parameters
2496
+ ----------
2497
+ weekday : int or None, default None
2498
+ Always generate specific day of week. 0 for Monday and 6 for Sunday.
2499
+
2500
+ Examples
2501
+ ---------
2502
+ ## Below examples explain the usage of this object.
2503
+ ## Importing modules
2504
+ import pandas as pd
2505
+
2506
+ date_format = "%Y -%m -%d "
2507
+ date_object = pd.to_datetime("2023-01-13",format = date_format)
2508
+ print(date_object)
2509
+ ## 2023-01-13 00:00:00
2510
+
2511
+ date_plus_one_week = date_object + pd.tseries.offsets.Week(1)
2512
+ print(date_plus_one_week)
2513
+ #2023-01-20 00:00:00
2514
+
2515
+ date_next_Monday = date_object + pd.tseries.offsets.Week(weekday=0)
2516
+ print(date_next_Monday)
2517
+ #2023-01-16 00:00:00
2518
+
2519
+ date_next_Sunday = date_object + pd.tseries.offsets.Week(weekday=6)
2520
+ print(date_next_Sunday)
2521
+ #2023-01-15 00:00:00
2522
+ """
2500
2523
2501
2524
_inc = timedelta(weeks = 1 )
2502
2525
_prefix = " W"
You can’t perform that action at this time.
0 commit comments