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.13.0.tar.gz (977.3 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.13.0-cp38-abi3-win_amd64.whl (3.7 MB view details)

Uploaded CPython 3.8+Windows x86-64

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

Uploaded CPython 3.8+Windows x86

polars_xdt-0.13.0-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.13.0-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.13.0-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.13.0-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.13.0-cp38-abi3-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

polars_xdt-0.13.0-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.13.0.tar.gz.

File metadata

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

File hashes

Hashes for polars_xdt-0.13.0.tar.gz
Algorithm Hash digest
SHA256 43bba9b06dc11a68a402f8b3479e640eb80808696e76663bf28498b6957be60a
MD5 fe899742c02c72ef0d0c0b0ecae5c182
BLAKE2b-256 e38e8a6cfa3fbc9347b6450da48c9836e0466dcf3ec23b5b03629df2eb2d27df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.13.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 17c2f68e526c4fcb51df157a38854256f3fc954824804bf6bacc3be924084866
MD5 d36fa8f335f1ecc00867dc118a880c00
BLAKE2b-256 772a18e26033bef7c3a22188c20326711d82e10855e3c3757eee3f45e690d494

See more details on using hashes here.

File details

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

File metadata

  • Download URL: polars_xdt-0.13.0-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.13.0-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 65094b6529331cea251a171afa15663ea366066df925aec4b663a521c548b4e8
MD5 3b35ac5b4ba6958e3cbd3b5fac6cf9c2
BLAKE2b-256 653cb14cdd0337a790309eb1c58bc3aa58abbbf9bf25a1d0ebef50829e05037c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.13.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57fb5c7c8b5598bef360f11116b3af41ec6667f4d5d8a497e0c8a18cb7f5995e
MD5 ff37299bf869425a39933729d13c2b91
BLAKE2b-256 4ad2a47e8ec728c92efe1d68d810d5258e5c8416c0edea4fa1109d8fbd023a71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.13.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 eeefa58b577b6275400524d2a20f2d40392d834e0e78143f1cc2b4b5bfc07282
MD5 aceab8196abe20fc09cd3f6f874df07a
BLAKE2b-256 05a1f1c09fc013921e001a14f3b35f1f67c5c6ac0594787fd266713531054531

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.13.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 d873a66d8806d38e02376c35c65420e88c5b90d245a85a496f351cc95d688f5f
MD5 17cad094cd2fbd729ff2ba697cfa6cb6
BLAKE2b-256 26ddbaf26c7bf3299d970a970a86c0e417409fc11f6405635c92f4c0c5a3ed5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.13.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e5c59a6c5ebc9b34a11aca495a23dfa19e92131e8eb13ec5a721ef3812ddc3f5
MD5 fa2cf041c88ce18adb4f9cd55c23d620
BLAKE2b-256 73e3d3253a0e1443c3696b7d956ce465ba998e9a0cb42972a704e3b0a92217cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.13.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 08282cbca6ec3dc9f9bafd9182731a5047bc684d267170973c252daa78bcfebf
MD5 deec90d16ebc320b8ab921870e9a949a
BLAKE2b-256 87388cd8f067c01d0fafdf1489e6145c523bf3d6a66b4d3d955721d2541ea58a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.13.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 321da1c5a48695401253699dd791c449be037f6c2bceb11a5d32a64394a51256
MD5 7ea7840052ab9e9fd82dcb5288b8c4c3
BLAKE2b-256 5bd5b27c2c0cd24204b5bd06c928b8402d66feabeccce90c69eae5ee800187e5

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

This release

0.13.0 This release

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

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