I'm trying to go over a DF I have but can't figure it out.
It's a script that checks an Excel file for dates of new employees.
import pandas as pd
import datetime as dt
xls = pd.ExcelFile(r'test.xlsx')
df = pd.read_excel(xls, 'New Employment')
df['Start Date'] = pd.to_datetime(df['Start Date'])
today = pd.Timestamp.today()
#Calculate how many days are left til the employee starts working
df['Starts In'] = (df['Start Date'] - today).dt.days
delta_df = df[['Name', 'Starts In']]
So at this point, delta_df
has the entire list of new employees. It prints out their name and number of days until they start working.
I would like to go over this DF and put a condition to check whether there's an employee who will start working in less than 5 days. If there is one, add it to a list/DF.
That list/DF will later be attached to an email I'll send.
I'm not sure how to perform this check.