Skip to main content

A library to display digits into groups of thousands and decimal using various delimiters.

Project description

Sepyrate

Sepyrate is a Python library to display digits separated into groups of thousands and decimal using delimiters such as comma (","), dot ("."), space (" "), or apostrophe ("'").

(1) Installation

Use the package manager pip to install sepyrate:

pip install sepyrate

(2) Prerequisites

None.

(3) Usage

The function to group digits in this library is digit_separation(), where its required input arguments are:

  • amount [int or float]: the digits to be separated
  • tsep [str]: delimiter for thousands separator

and the optional argument:

  • dsep [str]: delimiter for decimal separator, defaults to dsep='None'

The function returns string of digits.

Following Wikipedia:

  • For comma thousands separator tsep=",": available delimiters for decimal separator are dsep="None" and dsep=".".
  • For dot thousands separator tsep=".": available delimiters for decimal separator are dsep="None", dsep="," and dsep="'".
  • For space thousands separator tsep=" ": available delimiters for decimal separator are dsep="None", dsep="," and dsep=".".
  • For apostrophe thousands separator tsep="'": available delimiters for decimal separator are dsep="None", dsep="," and dsep=".".
  • Due to the complexity of Indian numbering system, it's not yet included here. But future release may have this system.

To use, import the function:

from sepyrate import digit_separation

For floating-point value digits, such as

amount = 1200.56

to display the digits into thousands with dot delimiter tsep='.', we can either include dsep=',' or without, such as

print(digit_separation(amount, '.', dsep=','))

or

print(digit_separation(amount, '.'))

Both will display

'1.200,56'

For integer digits, such as

value = 10000000

to display the digits delimited by space without decimal

print(digit_separation(value, ' '))

will display

'10 000 000'

or with decimal with comma delimiter

print(digit_separation(value, tsep=' ', dsep=','))

will display

'10 000 000,00'

or with decimal with dot delimiter

print(digit_separation(value, tsep=' ', dsep='.'))

will display

'10 000 000.00'

(5) Contributing

Interested in contributing? Please contact me directly.

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

sepyrate-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

sepyrate-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file sepyrate-0.1.0.tar.gz.

File metadata

  • Download URL: sepyrate-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.13

File hashes

Hashes for sepyrate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48431d44d33d259715f9e36cfb205db167ff223cd6a407c41439074c194cfbbb
MD5 ddfa57d7fc46cdca44fd622b14652851
BLAKE2b-256 eb1df38853b549d30c6f0ecc92b58e61c31c1e654a41d32dbc809d57eb6df48f

See more details on using hashes here.

File details

Details for the file sepyrate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sepyrate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.13

File hashes

Hashes for sepyrate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c4f25767bb35cae8c87f8c0f40bf3711df0b32bd5562f65e311647a6e010165
MD5 97e463f715b5b2aa8c5b1cb108af844d
BLAKE2b-256 039d001ede509799d6fb2a38ab2d25bfebbf2a76b02d4c37bfc90b2b7aba53c4

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