Module documentation¶
-
py_holiday_calendar.py_holiday_calendar.add_bus_days(df, col_op, col_res, days, workdays=[0, 1, 2, 3, 4])¶ Add business days to a column in pandas dataframe (to consider holidays, use the method with holidays).
The return type must be the modified df containing a new col with the results after adding provided business days.
Parameters: - df – The pandas dataframe to work on.
- col_op – Column with dates to add bus days to.
- col_res – New col with the modified dates.
- days – Number of business days to add.
- workdays – List of custom workdays.
Returns: Modified dataframe with new_col containg new business dates.
Return type: Dataframe
-
py_holiday_calendar.py_holiday_calendar.add_bus_days_with_holidays(df, col_op, col_res, days, workdays=[0, 1, 2, 3, 4], holidays=[])¶ Add business days to a column in pandas dataframe (holidays can be considered).
The return type must be the modified df containing a new column with the result after adding business days.
Parameters: - df – The pandas dataframe to work on.
- col_op – Column with dates to add bus days to.
- col_res – New col with the modified dates.
- days – Number of business days to add.
- workdays – List of custom workdays.
- holidays – List of custom holidays.
Returns: Modified dataframe with new_col containg new business dates.
Return type: Dataframe
-
py_holiday_calendar.py_holiday_calendar.calc_diff_with_holidays(df, start, end, new_col, workdays=[0, 1, 2, 3, 4], holidays=[])¶ Calculate difference between pandas df columns adjusting for custom bus and holidays. Start date is not included.
The return type will be the pandas dataframe.
Parameters: - df – The pandas dataframe to work on.
- start – Start Date column in the df.
- end – End Date column in the df.
- new_col – New column to be generated containing the difference.
- workdays – List of custom workdays.
- holidays – List of custom holidays.
Returns: Modified dataframe with new_col for difference between dates.
Return type: Dataframe
-
py_holiday_calendar.py_holiday_calendar.calc_workday_diff(df, start, end, new_col, workdays=[0, 1, 2, 3, 4])¶ Calculate difference between(to consider holidays as well, use the other method). Start Date not included.
The return type must be the modified df containing a new column with the diff result.
Parameters: - df – The pandas dataframe to work on.
- start – Start Date column in the df.
- end – End Date column in the df.
- new_col – New column containing the diff between the date cols provided.
- workdays – List of custom workdays.
Returns: Modified dataframe with new_col containing dif between business dates among provided cols.
Return type: Dataframe