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 @@ -2313,12 +2313,28 @@ cdef class YearEnd(YearOffset):
2313
2313
2314
2314
cdef class YearBegin(YearOffset):
2315
2315
"""
2316
- DateOffset increments between calendar year begin dates.
2316
+ DateOffset of one year at beginning.
2317
+
2318
+ YearBegin goes to the next date which is a start of the year.
2319
+
2320
+ See Also
2321
+ --------
2322
+ :class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.
2317
2323
2318
2324
Examples
2319
2325
--------
2320
- >>> ts = pd.Timestamp(2022, 1, 1)
2326
+ >>> ts = pd.Timestamp(2022, 12, 1)
2327
+ >>> ts + pd.offsets.YearBegin()
2328
+ Timestamp('2023-01-01 00:00:00')
2329
+
2330
+ >>> ts = pd.Timestamp(2023, 1, 1)
2321
2331
>>> ts + pd.offsets.YearBegin()
2332
+ Timestamp('2024-01-01 00:00:00')
2333
+
2334
+ If you want to get the start of the current year:
2335
+
2336
+ >>> ts = pd.Timestamp(2023, 1, 1)
2337
+ >>> pd.offsets.YearBegin().rollback(ts)
2322
2338
Timestamp('2023-01-01 00:00:00')
2323
2339
"""
2324
2340
You can’t perform that action at this time.
0 commit comments