pandas.tseries.holiday.next_workday#
- pandas.tseries.holiday.next_workday(dt)[source]#
Move to the next weekday.
The date is always advanced by at least one day, even when
dtalready falls on a weekday. To leave weekdays unchanged and move only weekend dates forward, usenext_mondayorweekend_to_monday.- Parameters:
- dtdatetime
The date to move forward from.
- Returns:
- datetime
The next weekday after
dt.
See also
tseries.holiday.previous_workdayMove to the previous weekday.
tseries.holiday.next_mondayMove Saturday and Sunday to the following Monday.
tseries.holiday.after_nearest_workdayMove to the workday after the nearest workday.
Examples
>>> from datetime import datetime >>> from pandas.tseries.holiday import next_workday >>> next_workday(datetime(2022, 1, 1)) # Saturday datetime.datetime(2022, 1, 3, 0, 0) >>> next_workday(datetime(2022, 1, 5)) # Wednesday, still advances datetime.datetime(2022, 1, 6, 0, 0)