Skip to main content

Business day utilities for Polars

Project description

Polars-business

polars-business

PyPI version Read the docs!

Business day utilities for Polars.

  • ✅ blazingly fast, written in Rust!
  • ✅ seamless Polars integration!
  • ✅ define your own custom holidays and weekends!

Installation

First, you need to install Polars.

Then, you'll need to install polars-business:

pip install polars-business

Then, if you can run

from datetime import date
import polars_business as plb

print(plb.date_range(date(2023, 1, 1), date(2023, 1, 10), eager=True))

it means installation all worked correctly!

Read the documentation for a little tutorial and API reference.

Basic Example

Say we start with

from datetime import date

import polars as pl
import polars_business as plb


df = pl.DataFrame(
    {"date": [date(2023, 4, 3), date(2023, 9, 1), date(2024, 1, 4)]}
)

Let's shift Date forwards by 5 days, excluding Saturday and Sunday:

result = df.with_columns(
    date_shifted=plb.col("date").bdt.offset_by(
      '5bd',
      weekend=('Sat', 'Sun'),
    )
)
print(result)
shape: (3, 2)
┌────────────┬──────────────┐
│ date       ┆ date_shifted │
│ ---        ┆ ---          │
│ date       ┆ date         │
╞════════════╪══════════════╡
│ 2023-04-03 ┆ 2023-04-10   │
│ 2023-09-01 ┆ 2023-09-08   │
│ 2024-01-04 ┆ 2024-01-11   │
└────────────┴──────────────┘

You can also count the number of business days between two given dates, specify a custom calendar holiday, and create a date range excluding workdays.

Read the documentation for more examples!

Performance

Single-threaded performance is:

  • about on par with NumPy (it's essentially a Rust reimplementation)
  • about an order of magnitude faster than pandas.

but note that Polars will take care of parallelisation for you, and that this plugin will fit in with Polars lazy execution and not require any data conversion.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

polars_business-0.3.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

polars_business-0.3.22-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl (7.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ s390x

polars_business-0.3.22-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (6.8 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

polars_business-0.3.22-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARMv7l

polars_business-0.3.22-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

polars_business-0.3.22-cp311-cp311-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

polars_business-0.3.22-cp311-cp311-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.11 macOS 10.12+ x86-64

polars_business-0.3.22-cp310-none-win_amd64.whl (3.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

polars_business-0.3.22-cp310-none-win32.whl (2.6 MB view details)

Uploaded CPython 3.10 Windows x86

polars_business-0.3.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

polars_business-0.3.22-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl (7.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ s390x

polars_business-0.3.22-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (6.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

polars_business-0.3.22-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.0 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARMv7l

polars_business-0.3.22-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

polars_business-0.3.22-cp310-cp310-macosx_11_0_arm64.whl (3.0 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

polars_business-0.3.22-cp310-cp310-macosx_10_12_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10 macOS 10.12+ x86-64

File details

Details for the file polars_business-0.3.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d4f1260a25966e9fa3d35ca4ccd1d4988aa2dc40bb7e8f30b7218405186a23a
MD5 14cd522c786428bfad4b4d1e684a1a29
BLAKE2b-256 c0bcf2af0612df26d76f0dbf82be21e117a2185586ca9eb6563571e00ac2a54a

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 3277e04dc79cd4c69d16d5895c4f5f779354de9f83d545903609590e1778c04f
MD5 f3d2b990232dd991561e98af9d3ede60
BLAKE2b-256 aafa234a222fac5a81777eb2016114c8b5f1903b0e2314e714606fabfe8e3ca7

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 eb9c6aad4635748a135dbf43976ec37f79cdfd4785287c13f2e67f926a7e38c6
MD5 9bec753e1ebe7260b6faf4465a84f347
BLAKE2b-256 8199936e4762c552ca082b1636e17d7776397c9b9ad7bc667aa4d3d830e262ed

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 792e4527d9176f744b44b36e5d64aaa0132ed49aace7e3419ee53ecec3c5dd6a
MD5 ad4c5aeb837277732327414dc5dd4bdc
BLAKE2b-256 205c02d193acabdb5deafba452d4a659b0499775fc6db5cb34b33640a31066d9

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 251385788c3d8f076a3328217e3beb303b60d111a55bc2ba1d2c9041b5ad4f98
MD5 1d5481301cf90995652433510f86dc7f
BLAKE2b-256 a7a39678854f6127809e7f8785abd60a2e469d51089224cac7f0cbfcbed87d1b

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3102c755f674132e23a29152bd1d4d24a25c358374dfd2f247c30f2d0fe35dd9
MD5 db4581241bb73aa9e981b2d15234a157
BLAKE2b-256 fd1349deb82398a217254ccd33c12ace92178a6faddca4a0cdb9107cb3b1a878

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 edd98ddf0d659a3d2b1ccbe167c80407b484e5ed3e6c0636d488d832ba437b29
MD5 bab9a2b73e2354b740856f091791faf3
BLAKE2b-256 de45ce9943629b586ddefe8249fe9787b36994ca5d13917cdc5a8b1e960f7a1d

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 87cef05d7d97db7cedb908e8ce66eeaf3451ebf8374ae82a25f367e0232640bc
MD5 af259609927aed91d2ad8ed471ef5afa
BLAKE2b-256 f997807e41dcc6bb0e8946c9504b0ea8de9f669d1be398ce0a66e908c9200a86

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-none-win32.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-none-win32.whl
Algorithm Hash digest
SHA256 b7e1ac7dcf2cdf83d20869994f38a6395b10b6105e619bdff7174d1b17e2245a
MD5 78027cd2ea7a4ee67c58bdac4621a878
BLAKE2b-256 38d1c7684e7282a40d05ea9baca4f77c8f158ecde76c11986515a1a9547855bc

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 694ba380e192b4e52caa3748c7f8bedaa05171e5cddddb79ecf309ae2928726e
MD5 d304accd1bcfe973fa162e6fb73da076
BLAKE2b-256 93dd73ed3584de26eda62bcbb65121feabf6a40640d3eac88693cd5bf745a290

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 82eadec88f10ced3ca10ee7d22fdd3ed024cf1790ba68ffb1b68d09454f3066d
MD5 1961a9716d9d140d9cb60ce3df62a249
BLAKE2b-256 09a11aa6f3ba14bc7c2da286f0fff9b6ca169ab69ac615af91ed13b4a7ae5b33

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 a7800313f75509b102e39f7a4b179dfc89af4caf766f7967a237314416410bc5
MD5 8566b5053b8067e17dd433fba192d771
BLAKE2b-256 d7f4f97f70cf97e62f936c35ae60281c2573c46befb47583fa3f0bd90c42c95f

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c770f4ed8beb0aa7a2a89f3547906d2e256edf32dd8ebf0d7c1cb111c023a9d4
MD5 b38235623ac46eccf29df2cd8302161f
BLAKE2b-256 9d5c8ba272d6113e1e59d313baa19ad4a254298462c5fccac1f91456354c4098

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2768fe26405378c2983ee825f4cb0bc6dd6851a9b58368a59d861af24ca1d814
MD5 5844aadb25090d6890ae655eef550d6b
BLAKE2b-256 708162bf1761e045d09192a6084192c6b6f87e70e24dea24157ebdc7e780bf80

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 840970cec20bf2bb492a4850dd2c191e298837f3806c0c379b2ec03d785fed06
MD5 d9b8bba53a73f84cd03449b45d5da445
BLAKE2b-256 214341395796119ec4a4730a95fb9e39e58192fd68833206eaaa9aa1ebab6817

See more details on using hashes here.

Provenance

File details

Details for the file polars_business-0.3.22-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for polars_business-0.3.22-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 570865b467cb2cb00f7bcf563bb5b176d87c895024ad3151b8824e7b748fcfac
MD5 ef4ec4b44b53bdbfdf320d80a7a00bad
BLAKE2b-256 8df95e2d6cdde08ebdc3ab9a949f83cbce5378609276032777d0c0db7c4bd623

See more details on using hashes here.

Provenance

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