eXtra stuff for Dates and Times in Polars
Project description
polars-xdt
eXtra stuff for DateTimes
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file polars_xdt-0.16.0.tar.gz
.
File metadata
- Download URL: polars_xdt-0.16.0.tar.gz
- Upload date:
- Size: 975.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17a76b6ba5f84fc877ec18d4f893aa3cadd9430499423f4cedb4cf046abe8692 |
|
MD5 | d2aabc7ef8ac717fb5f0eb55f9a6961d |
|
BLAKE2b-256 | fc476dc7edb16b2e73f564780075f33089a5c51bb4c54c45543265c0a9ac78a9 |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-win_amd64.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 4.5 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3017e8a7f38d4808d518d8fb5ce5f89c1232f2358fe71b97ca9186a141a03192 |
|
MD5 | 2ba5b7bb7e98daddeda93418781f2586 |
|
BLAKE2b-256 | ec10408ae49b61d224b3f0a025ab8343f72dcd3d76606e7ed8eeb28c7d6905bb |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-win32.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-win32.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.8+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ba19b04055733b6e827a65668790ff2f1c9e6baa4a21b85820d46fe74da743 |
|
MD5 | 06808bb2cbc58a6b8f0d22b952f95e00 |
|
BLAKE2b-256 | 84b311795d7c7c7ce7456eafa1c9ab94d91c97a6cd275ef69b9a3f46969156f0 |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e58ad1fdfd525dc015fbbe07a6c5f7b6880717b236fab545fc029335c1aa549 |
|
MD5 | a9ec689de976312d2567c6c2e19e3ea8 |
|
BLAKE2b-256 | 1d27f69430031c7c685336c551e643cf25a717ebc6fc84ed4021b6a702514c3b |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 5.6 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b74c936e89119065ccab203e6b37251ef237d49ae01479bb8d48bce6fe220a22 |
|
MD5 | cdb19501220b28e7b81c42ebce52b69b |
|
BLAKE2b-256 | ee4de09cb3254f9d4ae5f6c2b844074e706573856e8b015ab06ab709969c7cdb |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9da095720fdd3ed485a11ab4d1fd21f35fa817a91717d0e02a208697934bd1d |
|
MD5 | a3bfc93d76d567ffe8af0f52e0f19067 |
|
BLAKE2b-256 | 0ef7c00d2d09a28eb49c86f5ca202f404827dbc9b385d7424accfab75b304a58 |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd86ce20aeba55e659fb4cf31f3bad511f84579fb46796c641740ca2d66c3644 |
|
MD5 | 52fc43a5cfba3b2ea42f379fb90c51aa |
|
BLAKE2b-256 | 738a01bffa5b4901cb6fa351b24bb8a9690d23fae5c92a70b4abda4fb5b8a4cf |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 193b4a55bf1d3d9cf40637a0c15559b6ff3e5deffb9778748c487069210a1013 |
|
MD5 | cb5100d1010aa7661cbba0f00049d44d |
|
BLAKE2b-256 | eb66b751a4df67cbf17b5c570afb0bb1596638917b7e4f8be37f534968625d1a |
File details
Details for the file polars_xdt-0.16.0-cp38-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: polars_xdt-0.16.0-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ced8851b8b36cdb96849f3d79dcb8bfa349dd73b2817b737f1f359096c99ca87 |
|
MD5 | bbf8d7380f3e7bc3b67e725f9aef50dd |
|
BLAKE2b-256 | 59f2b89de7208557a0b0cebdb0bbe5be06e74920ad42e9b3629d659e9c3b292b |