Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2412,11 +2412,28 @@ cdef class MonthEnd(MonthOffset):
"""
DateOffset of one month end.

MonthEnd goes to the next date which is an end of the month.
To get the end of the current month pass the parameter n equals 0.

See Also
--------
:class:`~pandas.tseries.offsets.DateOffset` : Standard kind of date increment.

Examples
--------
>>> ts = pd.Timestamp(2022, 1, 1)
>>> ts = pd.Timestamp(2022, 1, 30)
>>> ts + pd.offsets.MonthEnd()
Timestamp('2022-01-31 00:00:00')

>>> ts = pd.Timestamp(2022, 1, 31)
>>> ts + pd.offsets.MonthEnd()
Timestamp('2022-02-28 00:00:00')

If you want to get the end of the current month pass the parameter n equals 0:

>>> ts = pd.Timestamp(2022, 1, 31)
>>> ts + pd.offsets.MonthEnd(0)
Timestamp('2022-01-31 00:00:00')
"""
_period_dtype_code = PeriodDtypeCode.M
_prefix = "M"
Expand Down