Skip to main content

Generic utility functions for text formatting, string operations, and type conversions.

Project description

dsr-utils

PyPI version Python versions License Changelog

Utility functions and helpers for common data science tasks, including datetime parsing, formatting, tables, and plotting helpers.

Version 1.0.0: This release is breaking and not backward-compatible with prior 0.x versions.

Features

  • Datetime utilities: Parse and enrich timestamps with pandas integration.
  • Formatting utilities: Numeric, currency, percentage, and datetime formatters.
  • Table helpers: Lightweight table definitions and rendering helpers.
  • Matplotlib helpers: Bounding box utilities for layout and export.
  • String utilities: Text processing and manipulation helpers.
  • Type utilities: Lightweight type conversion helpers.

Installation

pip install dsr-utils

Usage

from dsr_utils import (
	parse_datetime,
	DateTimeFormat,
	FloatFormat,
	Table,
	TableColumn,
	render_table,
)

# Datetime parsing (pandas integration)
ts = parse_datetime("2025-10-01 12:34:56")

# Formatting utilities
fmt = FloatFormat(precision=2)
print(fmt.format_value(1234.567))

# Date/time formatting
dt_fmt = DateTimeFormat(date_format="%Y-%m-%d", time_format="%H:%M")
print(dt_fmt.format_value(ts))

# Table helpers
table = Table(
	columns=[TableColumn("metric"), TableColumn("value")],
	rows=[{"metric": "rows", "value": 1234}],
)
render_table(table)

Requirements

  • Python >= 3.10
  • numpy
  • pandas (required for datetime utilities)
  • matplotlib (required for matplotlib helpers)

License

MIT License - see LICENSE file for details

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

dsr_utils-1.3.0.tar.gz (50.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dsr_utils-1.3.0-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

Details for the file dsr_utils-1.3.0.tar.gz.

File metadata

  • Download URL: dsr_utils-1.3.0.tar.gz
  • Upload date:
  • Size: 50.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dsr_utils-1.3.0.tar.gz
Algorithm Hash digest
SHA256 74f8888c6e5290531bf1b864b70bb2afcf4663fad2296ecfec5445613c0e3d31
MD5 77b8727952efb14b0578322e260fbc45
BLAKE2b-256 d6445499af19751a5f23944e99c192380c390f8bf781e75aae61a98922ee6532

See more details on using hashes here.

Provenance

The following attestation bundles were made for dsr_utils-1.3.0.tar.gz:

Publisher: python-publish.yml on scottroberts140/dsr-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dsr_utils-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: dsr_utils-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dsr_utils-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e981508e3d5d31197823cdb8c102b3dd9dff853860e85300c98cf98acbe7960
MD5 c12767d75e60febd8c910995eaad5300
BLAKE2b-256 fac4a244e4f43ee04009676c6e6db03c3e57f3e94a9f27e4621e836dc65eb599

See more details on using hashes here.

Provenance

The following attestation bundles were made for dsr_utils-1.3.0-py3-none-any.whl:

Publisher: python-publish.yml on scottroberts140/dsr-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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