gnosis-date-parser
Perform fast fuzzy parsing of dates in varying formats.
Background
Numerous prior projects to perform fuzzy date parsing are available on PyPI. The best of these appears to be https://pypi.org/project/dateparser/, but I have not tried all of them. All of those I have seen are written in pure-Python, and consequentially are too slow to use when the requirement is to parse tabular data with hundreds of thousands of dates in an interactive manner (e.g. at the time of data upload to a website where an immediate response is needed).
In many cases—arguably including the one motivating creation of this
library—transferring the slow operation to a background batch operation is a
reasonable approach. However, I learned of the very fast Rust library
dateparser (https://crates.io/crates/dateparser), which is as powerful in
recognizing many date formats as are any of the Python libraries I explored.
What I have used historically is the fuzzy date matching in Pandas; this is good, but for numerous other reasons, I wish to move away from Pandas (mostly in favor of Polars). However, one area where Pandas currently shines above Polars is in parsing heterogenous dates defined in the same column of source data. Yes, that is bad data and the provider should do better. In the real world, a lot of data looks that way.
This library is a thin wrapper around the existing Rust dateparser and
chrono. It was mostly created with the aid of an AI assistant. Although
commit messages attribute this Claude, the underlying model used was a slightly
customized version of MiniMax M2.7 that was hosted by a smaller AI vendor. I
simply used the Claude Code CLI as a way of interacting with the code and
model.
This library is thousands of times faster than any pure-Python library for
a similar task. I have not yet benchmarked it, but I believe it is also 10x+
faster than similar capability in pandas.to_datetime(..., format="mixed").
Design
The underlying Rust extension exposes three parsing functions. The Rust library created for this binding adds very little to the capabilities of crates it uses.
-
parse(raw: str) -> str | None— accepts a single raw date string and returns its ISO-8601 representation (orNonefor inputs the parser can't handle). -
parse_list(raw_dates: list[str]) -> list[str | None]— accepts a list of raw date strings and returns a list of ISO-8601 strings (orNonefor inputs the parser can't handle). The returned list matches the input length and order. This is the bulk-list path: one Rust call for the whole list. -
parse_series(s: pl.Series) -> pl.Series— accepts a Polars Series of string dtype and returns a Polars Series ofpl.Datetime("ns")(naive UTC, nanosecond precision). Unparseable strings become null values in the result. The Polars path works directly on the underlying Arrow buffer viapyo3-polars, so there is no Python-level iteration or list materialization.
All three paths use the same parsing logic via the
dateparser crate.
>>> import date_parser
>>> date_parser.parse("2026-01-01")
'2026-01-01 00:00:00+00:00'
>>> date_parser.parse("garbage") is None
True
>>> date_parser.parse_list(["2026-01-01", "garbage", "06/15/2024"])
['2026-01-01 00:00:00+00:00', None, '2024-06-15 00:00:00+00:00']
>>> import polars as pl
>>> date_parser.parse_series(pl.Series(["2026-01-01", "garbage"])).dtype
Datetime('ns')
Note: parsed datetimes are normalized to UTC (+00:00), matching the
behavior of the dateparser Rust crate. The Python dateparser library
preserves the original timezone offset; we don't (yet).
Pure-numeric inputs (e.g. "1511648546") are interpreted as Unix
timestamps and forced to UTC: 10 digits = seconds, 13 = milliseconds,
16 = microseconds, 19 = nanoseconds. The Python dateparser library
interprets these in the local timezone instead.
Installation
pip install gnosis-date-parser
Benchmarking
bin/benchmark.py measures throughput of the three date_parser
entry points side-by-side against the Python
dateparser reference:
# Benchmark all four libraries (the Rust extension has three modes)
uv run python bin/benchmark.py
# Benchmark a single library
uv run python bin/benchmark.py --library date_parser
uv run python bin/benchmark.py --library date_parser_list
uv run python bin/benchmark.py --library date_parser_series
uv run python bin/benchmark.py --library dateparser
# 10 timed iterations instead of the default 5
uv run python bin/benchmark.py -n 10
The --library choices map to the underlying APIs as follows:
--library |
API exercised | Calls per iteration |
|---|---|---|
date_parser |
parse(s) (per input) |
len(raw_inputs) |
date_parser_list |
parse_list(list) (bulk) |
1 |
date_parser_series |
parse_series(s) (Arrow) |
1 |
dateparser |
dateparser.parse(s) |
len(raw_inputs) |
After each timed run the script verifies the parsed output against the
expected ISO-8601 values in tests/data/examples.txt and prints any
mismatches.
On my system, at version 1.0, I see:
date_parser (Rust extension, this project) — parse() per input:
total parses: 475
failed parses: 0
elapsed: 0.000 s
throughput: 1,153,021 dates/sec
verification: 95/95 inputs matched expected
date_parser (Rust extension, this project) — parse_list bulk API:
total parses: 475
failed parses: 0
elapsed: 0.000 s
throughput: 1,297,230 dates/sec
verification: 95/95 inputs matched expected
date_parser (Rust extension, this project) — parse_series Polars API:
total parses: 475
failed parses: 0
elapsed: 0.000 s
throughput: 2,001,053 dates/sec
verification: 95/95 inputs matched expected
dateparser (Python reference, https://pypi.org/project/dateparser/):
total parses: 475
failed parses: 0
elapsed: 3.247 s
throughput: 146 dates/sec
verification: 10/95 inputs did not match expected
[... to be fair, examples were mainly drawn from the underlying Rust crate ...]
speedup (date_parser vs dateparser): 7882.0x faster
Local development
The project uses uv for environment and dependency management.
# Create a venv and install dev dependencies (maturin, pytest, ruff,
# mypy, mkdocs-material, ipython).
uv sync --extra dev
# Compile the Rust extension and install it editable into the venv.
uv run maturin develop --release
# Run the smoke tests (parse, parse_list, parse_series).
uv run pytest -q
# Lint and typecheck.
uv run ruff check .
uv run mypy bin tests date_parser
License
BSD-2-Clause. See LICENSE.
Release files for gnosis-date-parser 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gnosis_date_parser-1.0.2.tar.gz | 135.3 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| gnosis_date_parser-1.0.2-cp310-abi3-win_arm64.whl | CPython 3.10 | abi3 | Windows ARM64 | Details |
| gnosis_date_parser-1.0.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| gnosis_date_parser-1.0.2-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| gnosis_date_parser-1.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| gnosis_date_parser-1.0.2-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| gnosis_date_parser-1.0.2-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size:27.3 MB
Release files / gnosis_date_parser-1.0.2.tar.gz
| Download URL | gnosis_date_parser-1.0.2.tar.gz |
|---|---|
| Size | 135.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31cd22e0dfe03b5b10d7e726524252eff8c7bc66ec0702e89b35d49b3de56ff0
|
|
BLAKE2b-256 checksum How to use checksums |
0d8a88a73e5acef71d3141782205681a6712d40b494f448a79e92695ce901f6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / gnosis_date_parser-1.0.2-cp310-abi3-win_arm64.whl
| Download URL | gnosis_date_parser-1.0.2-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
e2c3b8703a7d327e91e5d907fdb4bdd4ca60173369fae277c667160b155f8df4
|
|
BLAKE2b-256 checksum How to use checksums |
251589ab5afb9d66378c81713bfcc8e6bc6cf039b831525b20c38fbf292fd908
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / gnosis_date_parser-1.0.2-cp310-abi3-win_amd64.whl
| Download URL | gnosis_date_parser-1.0.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 5.0 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
53b00ec2244b9ac32f5b41db007463851a39167761521ebcf98cf73f6477db89
|
|
BLAKE2b-256 checksum How to use checksums |
0671385261f87f18671fbd1697ec0a3ceebfaa9607ba843b760e299103120cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / gnosis_date_parser-1.0.2-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | gnosis_date_parser-1.0.2-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a0860f3549e9ee9af45cd7e8ce05b1eb9e5de61f00d7b8b55d933d8f4f75bd2d
|
|
BLAKE2b-256 checksum How to use checksums |
e36bd464fafa123fe54ad03c6b9917495c99c64291a1056e2635bd9ec856f7b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / gnosis_date_parser-1.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | gnosis_date_parser-1.0.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7e25d0455f1567efac744869da19a9947f916fb20f09807a357ad111461b352b
|
|
BLAKE2b-256 checksum How to use checksums |
4e853d9a5db9fb3cd32052c8df14989d8c273c1b0a362eff978c46b0e812b9b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / gnosis_date_parser-1.0.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | gnosis_date_parser-1.0.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
52e61a38280cc7c7e1c1a83b08c616fba5cc6a04cc253e176e1430e6e148c69f
|
|
BLAKE2b-256 checksum How to use checksums |
ce885fbe1eea086449233c8d5b8c44d154a2bf71f6bb021f2e2bfd0c5e9b1454
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency logRelease files / gnosis_date_parser-1.0.2-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | gnosis_date_parser-1.0.2-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
0a1cf65b2e98781156350eaf74dc5674832547aa7c75d09297665f739be3305a
|
|
BLAKE2b-256 checksum How to use checksums |
3ac91a56194eaf8a61d9876139edc95cd076c86fbc631d34f4ddb085a2b68974
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.
Transparency log