Days of service at a cut-off date

Data framesHard12 min

Your task

Given staff with columns name, team, salary, hired and manager, and an ISO cut-off date, return how many whole days each person had been employed on that date, as days. People hired after the cut-off are excluded. Return name and days, sorted by name ascending.

Examples

days_served(staff: dataframe, as_of: str) -> dataframe
Example 1
Inputdays_served(staff, "2024-01-01")
staff
nameteamsalaryhiredmanager
Adaeng1202021-03-01Grace
Graceeng1502019-06-15NULL
Linuseng952022-01-10Grace
Melsales802020-11-05Kay
Kaysales1102018-02-20NULL
Ivansales802023-07-01Kay
Jeandesign1052021-09-30NULL
Niadesign1402022-05-04Jean
More rows not shown
Output
namedays
Ada1036
Grace1661
Ivan184
Jean823
Kay2141
Linus721
Mel1152
Nia607
More rows not shown