Skip to main content

Simple date operations of difference and adding business days also adjusted for holidays.

Project description

py_holiday_calender is a Python package containing methods to manipulate date columns of pandas dataframes adjusting for business days and holidays.

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': ['GSIB', 'Data', 'GSIB', '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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_holiday_calendar-0.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distributions

py_holiday_calendar-0.0.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

py_holiday_calendar-0.0.1-py2.py3-none-any.whl (4.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file py_holiday_calendar-0.0.1.tar.gz.

File metadata

  • Download URL: py_holiday_calendar-0.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2

File hashes

Hashes for py_holiday_calendar-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9d3e8fe0e3525aafde7b3ff4c843f84b06230a2869fd0323dcbed87a1f7d3e2e
MD5 16f9d40727c3a574e77abc4bc930ca40
BLAKE2b-256 eef3bcfd5376420558e410192e60374a5233aba5c502040614cf1ae3792f31c1

See more details on using hashes here.

File details

Details for the file py_holiday_calendar-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: py_holiday_calendar-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2

File hashes

Hashes for py_holiday_calendar-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a122af605909e750fa3fa9c4f4bef800517150f86f7db212165fef1c947cd691
MD5 9fa4784cc6d5dd8494798eabc241abf7
BLAKE2b-256 bcde820d229338f717b0a2f9313a98583d16d9f4eb592f5fb2b22761d68e4224

See more details on using hashes here.

File details

Details for the file py_holiday_calendar-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: py_holiday_calendar-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2

File hashes

Hashes for py_holiday_calendar-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4e91a343f64811963ed4841b2b253c64974ce15def8a776a012fd995f2d5f273
MD5 c36deb22d41da7111460e24d2c40e9ab
BLAKE2b-256 06e6eafa4657c8eec0651bbd48b1bb64e6a5a0841a68985636099283a1896871

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page