8000 GitHub - hnei/si-prefix: Functions for formatting numbers according to SI standards.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.
/ si-prefix Public archive
forked from cfobel/si-prefix

Functions for formatting numbers according to SI standards.

License

Notifications You must be signed in to change notification settings

hnei/si-prefix

 
 

Repository files navigation

si_prefix

Functions for formatting numbers according to SI standards.

Example usage:

from si_prefix import si_format

print(si_format(.01331))
# 13.31 m

print(si_format(1331))
# 1.33 k

print(si_format(1331, format_str='{value:.1f} {prefix}')) # Reduce to 1 decimal place
# 1.3 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

About

Functions for formatting numbers according to SI standards.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%
0