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.0.0.tar.gz (38.4 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.0.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dsr_utils-1.0.0.tar.gz
Algorithm Hash digest
SHA256 75d55f2192b835c297ce2e4e6926c36e7d6a21b50327f7e2bc068fe295ae8d05
MD5 f9f1cc04b5d9cef974ea6de4b4d1a2c6
BLAKE2b-256 560b331ae60890fede760a983469121eda7dd6651b4d9ce0a3ac1befba362aee

See more details on using hashes here.

Provenance

The following attestation bundles were made for dsr_utils-1.0.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.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dsr_utils-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d1d7736f160ab7865cb399e63f7ad0c0da84c608e3d14ba35eb42f88c6405a4
MD5 59591b99cb24145895d4f66ea87f24d4
BLAKE2b-256 5a594a97171a2ac8c4e16ae5258f96418f2a70a1b09e123fdb48f2e0d6185691

See more details on using hashes here.

Provenance

The following attestation bundles were made for dsr_utils-1.0.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