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

Installation

First, you need to install Polars.

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

pip install polars-xdt

Read the documentation for a more examples and functionality.

Basic Example

Say we start with

from datetime import datetime

import polars as pl
import polars_xdt as xdt

df = pl.DataFrame(
    {
        "local_dt": [
            datetime(2020, 10, 10, 1),
            datetime(2020, 10, 10, 2),
            datetime(2020, 10, 9, 20),
        ],
        "timezone": [
            "Europe/London",
            "Africa/Kigali",
            "America/New_York",
        ],
    }
)

Let's localize each datetime to the given timezone and convert to UTC, all in one step:

result = df.with_columns(
    xdt.from_local_datetime(
        "local_dt", pl.col("timezone"), "UTC"
    ).alias("date")
)
print(result)
shape: (3, 3)
┌─────────────────────┬──────────────────┬─────────────────────────┐
│ local_dt            ┆ timezone         ┆ date                    │
│ ---                 ┆ ---              ┆ ---                     │
│ datetime[μs]        ┆ str              ┆ datetime[μs, UTC]       │
╞═════════════════════╪══════════════════╪═════════════════════════╡
│ 2020-10-10 01:00:00 ┆ Europe/London    ┆ 2020-10-10 00:00:00 UTC │
│ 2020-10-10 02:00:00 ┆ Africa/Kigali    ┆ 2020-10-10 00:00:00 UTC │
│ 2020-10-09 20:00:00 ┆ America/New_York ┆ 2020-10-10 00:00:00 UTC │
└─────────────────────┴──────────────────┴─────────────────────────┘

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.16.2.tar.gz (986.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_xdt-0.16.2-cp38-abi3-win_amd64.whl (4.6 MB view details)

Uploaded CPython 3.8+Windows x86-64

polars_xdt-0.16.2-cp38-abi3-win32.whl (4.2 MB view details)

Uploaded CPython 3.8+Windows x86

polars_xdt-0.16.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

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

polars_xdt-0.16.2-cp38-abi3-macosx_11_0_arm64.whl (3.8 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

polars_xdt-0.16.2-cp38-abi3-macosx_10_12_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for polars_xdt-0.16.2.tar.gz
Algorithm Hash digest
SHA256 c0dc2759d1aa5f280fc6ebb5b0317b6cc2e2367e68448f13b460c8cf75886c19
MD5 f40ad1ffc55a663b056f2996b5f34bc0
BLAKE2b-256 94ead1d43ced5b5985f88669afd986e0ea0d0e7614abd02b4ed0dbaf94762592

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6616da903905683d9a6060da427a00b92c41eb93de9fe1a68f4d7be2442dd6c7
MD5 5c36985d4ba90984dd52d843de79d714
BLAKE2b-256 d9b6c95a269a2c7ff0758601b45b7c8139c33fe9bbf931e6e3a3fe0934d0e6cd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for polars_xdt-0.16.2-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 8b4095b43e664cf1c3c5bdddb082121fd211726822d15074a0ba645aa954b2fc
MD5 4fd158d7d04bd1bfaa3979a20f49dd68
BLAKE2b-256 afce86065c57aa73670a79ba8ec7f2ec5d64ea6117a7a9ba01ce0ac079fb5ae5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21ee7b80d96141636ee1c38b8e5b7758c6dfc9fbbce77ec18c1a869d681ca01c
MD5 ec5a3275d9b40d321e4fe6eeb39c1cd7
BLAKE2b-256 4610676357b97660705c1294a57cc0ce9b2fae3c3796d3ab887e394f421377c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffb191cc7f95212a6dfc85fd74618380ddce86a14ac2dda61d5e141dbea7fa21
MD5 743327e04ee2a21e437524a52626be1b
BLAKE2b-256 ad81dfb2a2f3d03686ecd9a4d4e17a399d8f6ba1143f57b547e25ac8813165ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 135d72409c8a336475e211cc1f4f1ca44ebab4c24a1fa149461a878e9b30fed8
MD5 d94e8e31512a6716794d58f45ee0285d
BLAKE2b-256 bd2ef98e712599b1ba61b2285c559f9c75c7be8d4d9694ba3598395fa1ab22d1

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

This release

0.16.2 This release

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

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