1

here a some solutions around to calculate the day difference in python with excluding none business days (german business days):

Python - Exclude weekends between two Dates

Calculate difference between two dates excluding weekends in python?

But how can I apply this on a pandas dataframe, when I want to have the difference in hours and not in days?

When I try:

df['Diff'] = np.busday_count(df['end'], df['start'])

I receive the error:

TypeError: Iterator operand 0 dtype could not be cast from dtype('

So my target is to calculate:

start                end
2019-01-01 08:00:00  2019-01-08 08:00:00

Should lead to: df['Diff'] = 5*24 = 100

PV8
  • 5,799
  • 7
  • 43
  • 87

0 Answers0