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.1.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.1-cp38-abi3-win_amd64.whl (4.6 MB view details)

Uploaded CPython 3.8+Windows x86-64

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

Uploaded CPython 3.8+Windows x86

polars_xdt-0.16.1-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.1-cp38-abi3-macosx_11_0_arm64.whl (3.8 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

polars_xdt-0.16.1-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.1.tar.gz.

File metadata

  • Download URL: polars_xdt-0.16.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b9a59e736f5002d60250333d6482a517d08ebcaf9f1772ed1aeb28ee6161185f
MD5 f9d27b1f09c7f78b564d14f5061aeda9
BLAKE2b-256 607aed6a351faa33841c8628553a812654943b06503204f89ca0743d003e6aef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8c7e5e2813b6259d542a9eda7b787fe4791dab4700e2d8cb3a8df9554a962a5f
MD5 ba950c38d0a93dc85206daf9db8b62ed
BLAKE2b-256 9a6d9fa478a83860fb5dfcbeb745b5df53a8cfa0e97a67ae694e4cf0713d4a1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: polars_xdt-0.16.1-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.1-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 1150f55d5c84ffdae23cfd4c06779cfcd0d2b98cb041930e278485e807cc31fd
MD5 f1055061c9258fd68e23a1c34c3cfaf2
BLAKE2b-256 dfccaa4a88caf8c656ac98fa4a01a46008f50fbf8e8a445c4ede6f6428640f2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1911a29612be6f2e3a66b11cbb7da1d3efe5df08ea5abdefc665d84fb359f5a9
MD5 a25759a7bdda3706285b88600fd4faf7
BLAKE2b-256 d3af42701170e5205b25d3ce7ad794c24a68d79c3e0c0bc37fd60ff82c32d856

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8247eb78d3b0cee8c182732bc5d46fd78d17f7b1a76d17ac26be9bf6957f89c1
MD5 bcfdb986705a3d8b4878d80a4952416f
BLAKE2b-256 338cc0e85e1cd902bdcd4fbd83e5e4d56cfe02635bde9a1dc1831705818a8392

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_xdt-0.16.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 509417292b62fb91a279fc29fae6020916c4833d0930a90102c528d463079253
MD5 9da0ee9b45b15dc4e06e671940811622
BLAKE2b-256 e9dbea61e21e31da6ec254626433aff701f4038098c010e5fcba6d497fd3929f

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

This release

0.16.1 This release

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