py_holiday_calendar is a Python package containing methods to manipulate date columns of pandas dataframes adjusting for business days and holidays.
Usage
Just run the following snippet in your python env and start using the package.
pip install -v py-holiday-calendar
Docs
You can find the docs here.
Example
import pandas as pd
from py_holiday_calendar import py_holiday_calendar as check
# Making a dummy dataframe
df = {
'day': ['1/1/2018', '4/8/2019', '12/13/2019', '1/2/2019'],
'temp': [44, 45, 87, 66],
'str': ['Brake', 'Data', 'Gimp', 'data'],
'drake': ['eminem', 'marshall', 'drogon', 'eminem'],
'day1': ['1/5/2018', '4/12/2019', '12/31/2019', '1/8/2019'],
}
df = pd.DataFrame(df)
# Explicitly conveerting the columns to datetime (with which the package works)
df['day'] = pd.to_datetime(df['day'])
df['day1'] = pd.to_datetime(df['day1'])
# Pass in the arguments to cal diff between two date columns
check.calc_diff_with_holidays(df, 'day', 'day1', 'new_date')
print(df)
# Can also pass in custom business days as well as holidays
check.calc_diff_with_holidays(df, 'day', 'day1', 'new_date', workdays=[MO, TU, WE, TH])
print(df)
# Add custom business days to the provided column
check.add_bus_days_with_holidays(df, 'day', 'temp', 1)
print(df)
To-Dos
Add remaining methods.
Add the tests.
Metadata
Release files for py-holiday-calendar 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_holiday_calendar-0.0.6.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_holiday_calendar-0.0.6-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / py_holiday_calendar-0.0.6.tar.gz
| Download URL | py_holiday_calendar-0.0.6.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b991c2c72579dd43f2b197b30b93be94051b88b699b4b0e7c9a1b20384960f2
|
|
BLAKE2b-256 checksum How to use checksums |
881abe754ec4b57e228a24e205c1d7f72b871d4936b2eb29ffba875cefe60f3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6
|
Release files / py_holiday_calendar-0.0.6-py2.py3-none-any.whl
| Download URL | py_holiday_calendar-0.0.6-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1ada3382024950c081d3ca75ab5bb0938d2631f923c71d6582e2b4ba1856563a
|
|
BLAKE2b-256 checksum How to use checksums |
2a7d318488b0f345cbe345589f01c066a07bf825c1b047aef04cc6f21894dc63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6
|