I am just getting started on my journey of learning Python and have hit a wall trying to replicate a scenario that I commonly achieve using SAS.
I am reading in a .csv file which contains "Start" and "Complete" dates for projects. Once read in, I need to simply need to calculate the number of business days between the two dates.
What am I missing in this logic?
Thank you in advance for any help
I am reading in a .csv file which contains "Start" and "Complete" dates for projects. Once read in, I need to simply need to calculate the number of business days between the two dates.
Output:example csv file.
Title Start_Date Complete_Date
----- ---------- -------------
projTitle 1/19/20 1/26/20
projTitle2 2/11/20 2/15/20
Here is what I've done.1 2 3 4 5 6 7 8 9 |
#read list csv file parse_dates = [ 'Start_Date' , 'Complete_Date' ] df = pd.read_csv( 'sharepoint_requests_tst.csv' , parse_dates = parse_dates) #new column for bus day count df[ 'TAT' ] = np.busday_count(df[ 'Start_Date' ], df[ 'Complete_Date' ]) Error I get: TypeError: Iterator operand 0 dtype could not be cast from dtype( '<M8[ns]' ) to dtype( '<M8[D]' ) according to the rule 'safe' |
Thank you in advance for any help
Larz60+ write Dec-25-2020, 11:33 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
fixed for you this time, please use code tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
fixed for you this time, please use code tags on future posts.