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
  • ✅ custom business-day arithmetic
  • ✅ convert to and from multiple time zones
  • ✅ format datetime in different locales
  • ✅ convert to Julian Dates

Installation

First, you need to install Polars.

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

pip install polars-xdt

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 as xdt


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=xdt.offset_by(
      'date',
      '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   │
└────────────┴──────────────┘

Note that polars-xdt also registers a xdt namespace in the Expression class, so you could equivalently write the above using pl.col('date').xdt.offset_by('5bd') (but note that then type-checking would not recognise the xdt attribute).

Read the documentation for more examples!

Logo

Thanks to Olha Urdeichuk for the illustration.

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.12.11.tar.gz (976.1 kB view details)

Uploaded Source

Built Distributions

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

polars_xdt-0.12.11-cp38-abi3-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.8+Windows x86-64

polars_xdt-0.12.11-cp38-abi3-win32.whl (3.2 MB view details)

Uploaded CPython 3.8+Windows x86

polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.5 MB view details)

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

polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (7.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ i686

polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.8 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.0 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

polars_xdt-0.12.11-cp38-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

polars_xdt-0.12.11-cp38-abi3-macosx_10_12_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_xdt-0.12.11.tar.gz
Algorithm Hash digest
SHA256 5811b81ff31df79f0f591f381031a69f2491109c883f71c66e6268738fbee8ce
MD5 c2a0fa6566a051dec593c71a6fcdc652
BLAKE2b-256 ee5a76d57cf520f34b1c1b51731d7fc28ca18decaf28e56dcce3a2438dd35587

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b11c8dadad90836117778d2bcb9676f00bd9c9a9f79f4c8d39d2b08baf3f186f
MD5 df27f93ac89181919eac3f7bcb7da74e
BLAKE2b-256 8b1ea738cbd667c21240487f011b28b9a3247e8112292ab87190e568124fa892

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-win32.whl.

File metadata

  • Download URL: polars_xdt-0.12.11-cp38-abi3-win32.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.4.0

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 286ded8c2418d90eb9849105df428793b9315cb39ecd272ed0ad634190a499fa
MD5 8778c23ab16c007dd1f6f432e48587b9
BLAKE2b-256 452a36de9cda00ee01a33070478bd728262ab94900bf32106063145068e4e5a2

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 19a621fa411b3ab8125b4d55b4c41010858a42984bc9dd97723a327fe14dccd8
MD5 4ee74b3262e6d048d9f498633a2e7617
BLAKE2b-256 5f82ea0d3bd0f6ec35438b695d3206b8cc43c0595d1ca8c6fde7d25b83cc7c17

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7079a9006f6a37585f79550c508f3c91c6534c3847e31433390b5f7df9372541
MD5 64def0e974d457eb65a1a048f06b2e55
BLAKE2b-256 122d40bcc54ff802580943c011538a8e6d9a2c75742138a2ff61ba0093f3855e

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 7f68969e3d61a0f26146ba02af53af8eec992dc4775aeb86d8de48b2ba92eebf
MD5 53ebcc3c92adaddb6bfc94c5b8fe0f18
BLAKE2b-256 ef4bc72de66cd4006a3f245829bff5ea2a8113d73ea9e10b21ca77dc70b6f706

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 323204414bca72685c667ae9bc7be07c4bd9dcaa777cd57e289e411cea84644a
MD5 be06ac620e72122ec3f1fd89e478b294
BLAKE2b-256 1a6beb4f7350796cf55fef6849d84b8b3c6dd7caeed70959028f61216cb91a83

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b60bf8eccfb4ce8e2dda3ebb5b957ed51f7091949036162028979534bbc07991
MD5 51ef678ea5dc1d089b4884d641f44cb1
BLAKE2b-256 0b732ddea06f351740b7f37d3717466904e165ce1535cc07fbcbf773a64f0eea

See more details on using hashes here.

File details

Details for the file polars_xdt-0.12.11-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for polars_xdt-0.12.11-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b37bbc11396d311bf400466025b4b4f29ba71cbefac8f31fe2698a0b3e7f9817
MD5 e2dbc0cd8e4c09df127a1a49d0126d9e
BLAKE2b-256 8aa45b7576596e806b9bbb29e140d3a5a1e5348dd238646115f4565b9773b297

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

This release

0.12.11 This release

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

0.4.2

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