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 dt already falls on a weekday. To leave weekdays unchanged and move only weekend dates forward, use next_monday or weekend_to_monday.

Parameters:
dtdatetime

The date to move forward from.

Returns:
datetime

The next weekday after dt.

See also

tseries.holiday.previous_workday

Move to the previous weekday.

tseries.holiday.next_monday

Move Saturday and Sunday to the following Monday.

tseries.holiday.after_nearest_workday

Move 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)