Skip to main content

Time Series Extras (e.g. business day utilities) for Polars

Project description

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!

Installation

First, you need to install Polars.

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

pip install polars-xdt

Then, if you can run

import polars as pl
import polars_xdt  # noqa: F401

print(pl.col('a').xdt)

and see something like <polars_xdt.ExprXDTNamespace at 0x7f5bc943fc10>, 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   │
└────────────┴──────────────┘

Read the documentation for more examples!

Logo

Thanks to Olha Urdeichuk for the illustration.

Project details


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.7.1.tar.gz (974.0 kB view hashes)

Uploaded Source

Built Distributions

polars_xdt-0.7.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-pp38-pypy38_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-cp312-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

polars_xdt-0.7.1-cp312-none-win32.whl (2.7 MB view hashes)

Uploaded CPython 3.12 Windows x86

polars_xdt-0.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-cp312-cp312-macosx_11_0_arm64.whl (3.2 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

polars_xdt-0.7.1-cp312-cp312-macosx_10_12_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.12 macOS 10.12+ x86-64

polars_xdt-0.7.1-cp311-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

polars_xdt-0.7.1-cp311-none-win32.whl (2.7 MB view hashes)

Uploaded CPython 3.11 Windows x86

polars_xdt-0.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-cp311-cp311-macosx_11_0_arm64.whl (3.2 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

polars_xdt-0.7.1-cp311-cp311-macosx_10_12_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.11 macOS 10.12+ x86-64

polars_xdt-0.7.1-cp310-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

polars_xdt-0.7.1-cp310-none-win32.whl (2.7 MB view hashes)

Uploaded CPython 3.10 Windows x86

polars_xdt-0.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-cp310-cp310-macosx_11_0_arm64.whl (3.2 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

polars_xdt-0.7.1-cp310-cp310-macosx_10_12_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.10 macOS 10.12+ x86-64

polars_xdt-0.7.1-cp39-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

polars_xdt-0.7.1-cp39-none-win32.whl (2.7 MB view hashes)

Uploaded CPython 3.9 Windows x86

polars_xdt-0.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

polars_xdt-0.7.1-cp38-none-win_amd64.whl (3.1 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

polars_xdt-0.7.1-cp38-none-win32.whl (2.7 MB view hashes)

Uploaded CPython 3.8 Windows x86

polars_xdt-0.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

polars_xdt-0.7.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (6.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

polars_xdt-0.7.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (6.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARMv7l

polars_xdt-0.7.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page