df.head(3)
Out[20]:
First_date Second_date
0 2021-09-18 2021-09-17
1 2021-09-22 2021-09-17
2 2021-09-27 2021-09-17
I have calculated the difference between the two date_columns but I want to exclude only Sundays from the dates, right now what I have calculated his for a whole week.
df["First_date"] = df['First_date'].astype('datetime64[ns]')
df["Second_date"] = df['Second_date'].astype('datetime64[ns]')
df["days"] = df["First_date"].sub(df ["Second_date"],axis=0)
df.head(3)
Out[20]:
First_date Second_date days
0 2021-09-18 2021-09-17 1
1 2021-09-22 2021-09-17 5
2 2021-09-27 2021-09-17 10
df.head(3)
Out[20]:
First_date Second_date days expected_outcome
0 2021-09-18 2021-09-17 1 1
1 2021-09-22 2021-09-17 5 4
2 2021-09-27 2021-09-17 10 8
This is how I used to calculate the number of days till now.