@@ -2291,13 +2291,29 @@ cdef class BYearBegin(YearOffset):
2291
2291
2292
2292
cdef class YearEnd(YearOffset):
2293
2293
"""
2294
- DateOffset increments between calendar year ends.
2294
+ DateOffset increments between calendar year end dates.
2295
+
2296
+ YearEnd goes to the next date which is the end of the year.
2297
+
2298
+ See Also
2299
+ --------
2300
+ :class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.
2295
2301
2296
2302
Examples
2297
2303
--------
2298
2304
>>> ts = pd.Timestamp(2022, 1, 1)
2299
2305
>>> ts + pd.offsets.YearEnd()
2300
2306
Timestamp('2022-12-31 00:00:00')
2307
+
2308
+ >>> ts = pd.Timestamp(2022, 12, 31)
2309
+ >>> ts + pd.offsets.YearEnd()
2310
+ Timestamp('2023-12-31 00:00:00')
2311
+
2312
+ If you want to get the end of the current year:
2313
+
2314
+ >>> ts = pd.Timestamp(2022, 12, 31)
2315
+ >>> pd.offsets.YearEnd().rollback(ts)
2316
+ Timestamp('2022-12-31 00:00:00')
2301
2317
"""
2302
2318
2303
2319
_default_month = 12
@@ -2316,9 +2332,9 @@ cdef class YearEnd(YearOffset):
2316
2332
2317
2333
cdef class YearBegin(YearOffset):
2318
2334
"""
2319
- DateOffset of one year at beginning .
2335
+ DateOffset increments between calendar year begin dates .
2320
2336
2321
- YearBegin goes to the next date which is a start of the year.
2337
+ YearBegin goes to the next date which is the start of the year.
2322
2338
2323
2339
See Also
2324
2340
--------
0 commit comments