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.2.0.tar.gz (46.2 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.2.0-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dsr_utils-1.2.0.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for dsr_utils-1.2.0.tar.gz
Algorithm Hash digest
SHA256 4632e2c6f1874292fe197ac5a5b80a904cda714a14c6b796dc0f373fae2889fd
MD5 456873ff106505020afbff82559ee701
BLAKE2b-256 44d4b69a9dd115a8b96d5f8d15c17a37eb21bbf83a91f2608cad8d9804fdef1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dsr_utils-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for dsr_utils-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1dc96309707167bda11973480695c61ccda2e0c78bc6249800b095b4c90bbf14
MD5 210f5f440ad923059244d741183ea732
BLAKE2b-256 fcbf2ef4b67f570e4528a2372d54196be1c7c5dc88608d57a0676d50f2591d60

See more details on using hashes here.

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