Skip to main content

No project description provided

Project description

Polars Holidays

Plugin for the polars dataframe library to work with holidays.

Installation

pip install polars-holidays

Usage

To use the is_holiday and get_holiday functions in Polars, follow the examples below. Importing the Library

import polars as pl
import polars_holidays as plh

Check if a Date is a Holiday

You can check if a specific date is a holiday for a given country using the is_holiday function.

Use ISO-2 Country code in lowercase.

df = pl.DataFrame(
    {
        "date": ["2023-01-01", "2023-12-25"],
        "country": ["us", "us"]
    }
)

df = df.with_columns(
    is_holiday=plh.is_holiday("date", "country")
)

Get the name of the holiday(s)

To retrieve the name of the holiday for a specific date and country, use the get_holiday function. If there are multiple holidays on the same day, it will return as a semi-colon separated list of holidays.

df = df.with_columns(
    holiday_name=plh.get_holiday("date", "country")
)

Single country

If you don't have a column with country code, and just want to specify a single country, you can use pl.Lit("us"):

df = df.with_columns( holiday_name=plh.get_holiday("date", pl.Lit("us")) )

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

polars_holidays-0.1.0.tar.gz (532.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

polars_holidays-0.1.0-cp38-abi3-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.8+Windows x86-64

polars_holidays-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

polars_holidays-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

polars_holidays-0.1.0-cp38-abi3-macosx_11_0_arm64.whl (4.0 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

polars_holidays-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file polars_holidays-0.1.0.tar.gz.

File metadata

  • Download URL: polars_holidays-0.1.0.tar.gz
  • Upload date:
  • Size: 532.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.1

File hashes

Hashes for polars_holidays-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cfaa0d54f2366bd7591c556570077981187bf0af68f0c85a4fc4d319f759be17
MD5 93f92b19061336b1f7f63576e9675272
BLAKE2b-256 8758f1f4ff8e562e4727e1ab274142ff464a953b2f0b9f79284c2ee467254994

See more details on using hashes here.

File details

Details for the file polars_holidays-0.1.0-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for polars_holidays-0.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0d5785699e733eb3494140e26b558d321623997e67f75cb1066d93ac6b60b9e2
MD5 eddcb261bf6e4f05a1765b8e5f3eea7c
BLAKE2b-256 16867aae5925ed9421c5dd318a885113d4aee5622da198b6bdfd0d15dc3fa128

See more details on using hashes here.

File details

Details for the file polars_holidays-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_holidays-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d59853fd43554047cdbc75be250c85436e0896686f7734380778fa0497645baa
MD5 1f5821d09fe54a26badc5aa735e357f1
BLAKE2b-256 aa159a697de3afdade522eead0ad722e3f1e5863c20b230ca03cb0523dd6a8c3

See more details on using hashes here.

File details

Details for the file polars_holidays-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for polars_holidays-0.1.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f07d532846f776901560eab8c4cb7c51f498bbf2a0f6f1cf6b8edb16862be6a8
MD5 3a0b52c08380dbc28a420ee6e62300b0
BLAKE2b-256 d39a94b6c8fca516a8eb5301580fdfe1714a43c3ca8d280c17043c5d4758c3c3

See more details on using hashes here.

File details

Details for the file polars_holidays-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_holidays-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41613f1cc876e2921f90dc6655c3baf954c23184c362e98e21e83a316fd35ab1
MD5 8e2dd9b674fa206813d79a984f5d6506
BLAKE2b-256 1b82f3eec8055b86ed7698c4c2bbcede0527fae0c8a8438fe82e014e7310bb3e

See more details on using hashes here.

File details

Details for the file polars_holidays-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for polars_holidays-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6b1bc427e9d257ffae89b4d9c690ab72bab2630d22db8f1bca2f3cf13be5de23
MD5 87362bfd13fff496379bc41c397ef1a4
BLAKE2b-256 8881cec41482b22fb22fe8bb283c3a4d29e9047193054d9b384ec9552146804a

See more details on using hashes here.

Supported by

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