here are two really useful questions for datetime comparison in python:
Calculate Pandas DataFrame Time Difference Between Two Columns in Hours and Minutes
Determine the difference between two DateTimes, only counting opening hours
I have a dataframe in python with two columns:
A B
10:00:00 01.01.2019 12:00:00 02.01.2019
And I have opening hours (which are relevant hours), which only should count for the calculation, so not the full 24 hours and maybe not every day. So my business would be open from: 10:00:00 - 18:00:00 every day, how can i adjust:
df_time['td'] = df_time['B']-df_time['A']
That the outcome would be 10 hours in this case? And it is open from monday to friday.