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.15.0.tar.gz
.
File metadata
- Download URL: polars_xdt-0.15.0.tar.gz
- Upload date:
- Size: 975.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df213f83dfeebc1848256c6d37e23a4e30e8c00ebb0e9b88c30fc56226276bb7 |
|
MD5 | 7bb47803b78307ede2dfbbad5e8fb03e |
|
BLAKE2b-256 | 94b14c56baaea25bc24e5687e62625046ac4549c739a7a176f9ededb62261476 |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-win_amd64.whl
.
File metadata
- Download URL: polars_xdt-0.15.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50685597308cd16b75b2fa31129422ae5bff89fa78bdcbd5225f3167dd252842 |
|
MD5 | aef9bd5f1af6344ae04193e74b47d4b0 |
|
BLAKE2b-256 | 51db1600c7b9a0a6016288baa7fee688ea0bef50f796e66f1ebcc1eb1b85e5b1 |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-win32.whl
.
File metadata
- Download URL: polars_xdt-0.15.0-cp38-abi3-win32.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.8+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 479d6425bde822b38d59e43a3c31d5f7c227eb60418bc9d55bc29a96c2aaf6e9 |
|
MD5 | 7dcc35c6f3881d24f941a8a0b0f9a443 |
|
BLAKE2b-256 | f41bc65d735904580976d98b42beafa40e78334ed5960a78ab4103856ed3233f |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: polars_xdt-0.15.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 623fd4800871298d9e27bf1068f57482ef6f4b9b6083ac34949ecbe7bab7b8c6 |
|
MD5 | 5e84e09288906f1b63b8e6f6d4a6041d |
|
BLAKE2b-256 | f6e036201839337726a1015ecee6d5e1ead2146e81cb490a4ada4d9fadc33fe5 |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: polars_xdt-0.15.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.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35f413896b77e0462cd5c2f1f16989fbf21ae5ebbacd8a12ac5f1795292f4e12 |
|
MD5 | 2875b1ddbc893a8f727ea932351d1894 |
|
BLAKE2b-256 | 621dca8d89e9696cf761329ba04748b01d50415abda7d846ee1630a3afccd208 |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: polars_xdt-0.15.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.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a124813f2423712e9416aedbdc78b5b5ea63ec06197e093e656ddb67b49a0e79 |
|
MD5 | 7e8ef6bcaf5bfabb6b10c1e539523fdd |
|
BLAKE2b-256 | 142da7ca1bf2a62aa08909d47b6e92a5a5f920f76cce07b55a3886c85d908faf |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: polars_xdt-0.15.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 921100f7b5c6e2bd39e25311e136bcbcf12a01c990ef83a33b2d34786bd097f9 |
|
MD5 | ea5dfe04e091de3e7903dcdab3f3af27 |
|
BLAKE2b-256 | b6b9733a1ec756dd4b331538cb576cc62b975c696f1ff9a9dd4067af0ec06c3a |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: polars_xdt-0.15.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bd16f2766f6d3bbbb20c4ef49d3e08cd71fbdcfe5626b6e6872e57be11652be |
|
MD5 | c3cf210fbf3c957f14e9d5a8b7e77878 |
|
BLAKE2b-256 | 04cc9fe26e2f07c6cd54ec92a575c2c787390dae0864e2e89e35061a348b925c |
Provenance
File details
Details for the file polars_xdt-0.15.0-cp38-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: polars_xdt-0.15.0-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 4.5 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d26e013fd55c0b1d6a18d2236726c626d35a15387da923589174e989f1b51de5 |
|
MD5 | ef5a53b465b0dbbf682176dd679447eb |
|
BLAKE2b-256 | c73a6044e85f68c579213a5a4f1e5b98b3aae86291d19e18c30f9a077a736cd9 |