A utility library for data cleaning and parsing.
Project description
smith-utils
Smith Utils is a central hub for data cleaning and parsing scripts. This package consolidates distributed utility functions to improve code reuse and maintenance efficiency across all yeiichi projects.
Key Features
📅 Datetime Utilities (smith_utils.datetime)
Robust date parsing and formatting.
ensure_date: Flexible conversion of strings,datetime.dateobjects, orNone(returns today) into adateobject.parse_strict_date: Strict parsing forYYYYMMDDorYYYY-MM-DDformats, rejecting ambiguous inputs.format_ordinal: Converts integers to ordinal strings (e.g.,1→"1st",22→"22nd").
🔢 Numeric Refinement (smith_utils.numeric)
Clean and parse messy numeric data.
parse_numeric_value: Handles custom separators, decimals, and negative formats like(1,234.56).parse_currency_value: Alias for numeric parsing, specifically for currency strings.
📝 Text Normalization & Metrics (smith_utils.text)
Standardize text and compare string similarity.
normalize_text: Unicode NFKC normalization, case folding, and whitespace handling.StringDistance: Implementation of Damerau-Levenshtein and Jaro-Winkler algorithms for fuzzy matching.
Installation
Install via pip:
pip install smith-utils
Quick Start
from smith_utils.datetime.date_utils import ensure_date
from smith_utils.numeric.refinement import parse_numeric_value
from smith_utils.text.normalization import normalize_text
# Datetime
date = ensure_date("20231225") # datetime.date(2023, 12, 25)
# Numeric
value = parse_numeric_value("(1,250.50)") # -1250.5
# Text
clean_text = normalize_text(" Smith Utils ") # "smith utils"
Directory Structure
src/smith_utils/: Main package source.legacy/: Legacy scripts and templates (not included in distribution).tests/: Comprehensive test suite.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smith_utils-0.1.0.tar.gz.
File metadata
- Download URL: smith_utils-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1186c31e93d8a7769df32af10550555b00007d102f342c6866da7c0c823b3b07
|
|
| MD5 |
651bac359175184d85ad1fca6388a7ff
|
|
| BLAKE2b-256 |
f818f1d9e98f85a75524a02916aa37382034ef7330f42a1172c3c95458018764
|
File details
Details for the file smith_utils-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smith_utils-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f9cc2e6238845c8bb7966bd3029f2c831c79843ae075c31b34e6e795daf0048
|
|
| MD5 |
d47a9eb19f464672c0578551860df78b
|
|
| BLAKE2b-256 |
c45c5b3618a1ec2230e948b97c5dd0da0b57e60d5e79a1548cab119d481ce869
|