Skip to main content

polars-xdt

eXtra stuff for DateTimes

polars-xdt

PyPI version Read the docs!

eXtra stuff for DateTimes in 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-xdt:

pip install polars-xdt

Then, if you can run

from datetime import date
import polars_xdt as xdt

print(xdt.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_xdt  # noqa: F401


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=pl.col("date").xdt.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!

Download files

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

Source Distribution

polars_xdt-0.4.2.tar.gz (966.9 kB view details)

Uploaded Source

Built Distribution

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

polars_xdt-0.4.2-cp310-cp310-manylinux_2_34_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file polars_xdt-0.4.2.tar.gz.

File metadata

  • Download URL: polars_xdt-0.4.2.tar.gz
  • Upload date:
  • Size: 966.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.4.0

File hashes

Hashes for polars_xdt-0.4.2.tar.gz
Algorithm Hash digest
SHA256 2a574cdf66c95a501a66ab0bec1073d72cad782e80f99a9cc1d0339fcc98a1e1
MD5 574f24aeede499516c0be08b2f51947e
BLAKE2b-256 16be5cf994f89e148785a93cb8f050047b6d4752a22d06ac30063cd5aa1cece4

See more details on using hashes here.

File details

Details for the file polars_xdt-0.4.2-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for polars_xdt-0.4.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5569bd1ac748ff01ab8617391c1fbad17ddd0d0f9c4f0842667e14c4e0a2e8c3
MD5 c3546a42cddc2169635c5399b244ba66
BLAKE2b-256 b453f9ff58771f1cb80268ecc9218cb875c96186159d010d5cdbd5c951f81d42

See more details on using hashes here.

Release history Release notifications | RSS feed

0.17.1

6 files

0.17.0

6 files

0.16.8

6 files

0.16.7

6 files

0.16.2

6 files

0.16.1

6 files

0.16.0

9 files

0.15.3

9 files

0.15.2

9 files

0.15.0

9 files

0.14.14

9 files

0.14.13

9 files

0.14.12

9 files

0.14.11

9 files

0.14.10

9 files

0.14.7

9 files

0.14.6

9 files

0.14.5

9 files

0.14.3

9 files

0.14.2

9 files

0.14.1

9 files

0.14.0

9 files

0.13.0

9 files

0.12.11

9 files

0.12.8

9 files

0.12.7

9 files

0.12.6

51 files

0.12.5

51 files

0.12.4

51 files

0.12.3

51 files

0.12.2

51 files

0.12.1

51 files

0.11.0

51 files

0.10.0

51 files

0.9.0

51 files

0.8.1

51 files

0.8.0

51 files

0.7.1

51 files

0.7.0

51 files

0.6.0

51 files

0.5.7

51 files

0.5.3

51 files

0.5.2

51 files

0.5.1

51 files

0.5.0

51 files

0.4.3

69 files

This release

0.4.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page