I want to calculate business days with np.busday_count but some rows have start date and some rows don't have
import numpy as np
import pandas as pd
dfProd = pd.read_csv('fgc.csv', low_memory=False)
def business_days(start, end):
mask = pd.notnull(start) & pd.notnull(end)
start = start.values.astype('datetime64[D]')[mask]
end = end.values.astype('datetime64[D]')[mask]
result = np.empty(len(mask), dtype=float)
result[mask] = np.busday_count(start, end)
result[~mask] = np.nan
return result
dfProd['prod'] = business_days(dfProd['Start'], dfProd['End'])
print(dfProd)
but I got this error
ValueError: Could not convert object to NumPy datetime
I added prod where I will add Business Days
How I can skip Null rows but not drop them?