pandas.tseries.holiday.weekend_to_monday#
- pandas.tseries.holiday.weekend_to_monday(dt)[source]#
Move Saturday and Sunday to the following Monday.
Same as
next_monday. Needed for holidays such as the Christmas observation in Europe.- Parameters:
- dtdatetime
The date the holiday falls on.
- Returns:
- datetime
The date the holiday is observed on.
See also
tseries.holiday.next_mondayMove Saturday and Sunday to the following Monday.
tseries.holiday.sunday_to_mondayMove Sunday to the following Monday.
tseries.holiday.HolidayClass that defines a holiday with start/end dates and rules for observance.
Examples
>>> from datetime import datetime >>> from pandas.tseries.holiday import weekend_to_monday >>> weekend_to_monday(datetime(2022, 1, 1)) # Saturday datetime.datetime(2022, 1, 3, 0, 0) >>> weekend_to_monday(datetime(2022, 1, 2)) # Sunday datetime.datetime(2022, 1, 3, 0, 0)