Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
a tiny cup of pandas solution in 3rd party category for Working Hours Calculator by rybld2
import pandas as pd
def working_hours(date1: str, date2: str, start_time: str, end_time: str, holy: list[str]) -> int:
days = len(pd.bdate_range(date1, date2)) -len(holy)
t1, t2 = start_time.split(":"), end_time.split(':')
hours = (int(t2[0]) * 60 + int(t2[1])) - (int(t1[0]) * 60 + int(t1[1]))
return round(hours/60*days, 2)
April 8, 2023
Comments: