Skip to main content

si_prefix

codecov

Functions for formatting numbers according to SI standards.

Example usage:

from si_prefix import si_format

print si_format(.5)
# 500.0 m  (default precision is 1)

print si_format(.01331, precision=2)
# 13.31 m

print si_format(1331, precision=2)
# 1.33 k

print si_format(1331, precision=0)
# 1 k

Changelog

  • 1.0: use unicode strings and use µ (i.e., \N{MICRO SIGN}) to denote micro (not u).
    • Note: switching to unicode strings is an API-breaking change and may break code expecting a str return type.
    • See issue #4 for more details.
  • 0.5: change license to 3-clause BSD
  • 0.4.1: add space before unit prefix
  • 0.4: add Python 3 support, si_parse function
  • 0.2: bug fixes
  • 0.1: initial release

Credits

Written by Christian Fobel christian@fobel.net

Ported from C version written by Jukka “Yucca” Korpela jkorpela@cs.tut.fi.

Contributors

Python 3 support: olehermanse

License

This project is licensed under the terms of the BSD 3-clause license

Metadata

Release files for si-prefix 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for si-prefix 1.3.3
File Size Uploaded
si_prefix-1.3.3.tar.gz 20.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for si-prefix 1.3.3
File Interpreter ABI Platform
si_prefix-1.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / si_prefix-1.3.3.tar.gz

Download URL si_prefix-1.3.3.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e0ee62c6aefea83d502509d6bb7047c344c38418816406046cb6588f84f44152
BLAKE2b-256 checksum
How to use checksums
b7a41857f675a120e5b9a1b88534664b6f33b6513f8233cd55e410249441c7a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / si_prefix-1.3.3-py3-none-any.whl

Download URL si_prefix-1.3.3-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c665c38a43d69eeed3e27ee4b1d301225f202024eb2577df9879fe1f272164c6
BLAKE2b-256 checksum
How to use checksums
ae0bbb1f24a3b168d311278718134844d28e5bbf9a3786d9eac3550f9ff1f14d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.3.3 This release

2 release files

1.3.2

2 release files

1.2.2

1 release file

1.2.1

1 release file

1.0

1 release file

0.5

1 release file

0.4.1

1 release file

0.4

1 release file

0.3

2 release files

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page