File tree 1 file changed +18
-2
lines changed
1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2310,13 +2310,29 @@ cdef class YearEnd(YearOffset):
2310
2310
2311
2311
cdef class YearBegin(YearOffset):
2312
2312
"""
2313
- DateOffset increments between calendar year begin dates.
2313
+ DateOffset of one year at beginning.
2314
+
2315
+ YearBegin goes to the next date which is a start of the year.
2316
+
2317
+ See Also
2318
+ --------
2319
+ :class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.
2314
2320
2315
2321
Examples
2316
2322
--------
2317
- >>> ts = pd.Timestamp(2022, 1 , 1)
2323
+ >>> ts = pd.Timestamp(2022, 12 , 1)
2318
2324
>>> ts + pd.offsets.YearBegin()
2319
2325
Timestamp('2023-01-01 00:00:00')
2326
+
2327
+ >>> ts = pd.Timestamp(2023, 1, 1)
2328
+ >>> ts + pd.offsets.YearBegin()
2329
+ Timestamp('2024-01-01 00:00:00')
2330
+
2331
+ If you want to get the start of the current year:
2332
+
2333
+ >>> ts = pd.Timestamp(2023, 1, 1)
2334
+ >>> pd.offsets.YearBegin().rollback(ts)
2335
+ Timestamp('2023-01-01 00:00:00')
2320
2336
"""
2321
2337
2322
2338
_default_month = 1
You can’t perform that action at this time.
0 commit comments