Skip to main content

A package to map numbers to text labels.

Project description

num2label

A package to map numbers to text labels. For example, n maps to the nth letter of the alphabet. You can also map numbers to their corresponding spreadsheet column labels.

Quick start

To get started, import num2label:

>>> import num2label

Integer to letter

Map an integer to an uppercase letter of the alphabet:

>>> num2label.uppercase_letter(1)
'A'

Or a lowercase letter:

>>> num2label.lowercase_letter(26)
'z'

Integer to spreadsheet column label

Map a number to a spreadsheet column label:

>>> num2label.spreadsheet_column(28)
'AB'

Number bounds

The number must always be greater than zero. The number can be greater than 26. uppercase_letter and lowercase_letter will effectively loop the alphabet until the corresponding letter is reached (e.g., 27 => 'a', 55 => 'C'). To ensure the number passed is strictly less than 27, pass strict=True. num2label.lowercase_letter(27, strict=True) will raise an error because the number is not between one and 26 (inclusive).

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

num2label-1.0.0.post1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

num2label-1.0.0.post1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file num2label-1.0.0.post1.tar.gz.

File metadata

  • Download URL: num2label-1.0.0.post1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for num2label-1.0.0.post1.tar.gz
Algorithm Hash digest
SHA256 5248dfe08c84e1564a6a181e2cadc872b06a276db1195797eea1741c2b63e49a
MD5 80edf5e733c67a4c862d244f32c74b8e
BLAKE2b-256 d29bc9876cf375546ffb62598fc470e7baf8015a2cdc7edcd464e645feb033b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for num2label-1.0.0.post1.tar.gz:

Publisher: python-publish.yml on ethanbradley/num2label

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file num2label-1.0.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for num2label-1.0.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a146d07cedd25fd813d4c66fca49ebc6bebcce2b14557c972a54b93fd29bd4e
MD5 83372ee30ed44e82e391143a416a055d
BLAKE2b-256 ec92b61a58e7f06ebc4a4d3b986d63724c3800e13360aad454eab9a98eb7781f

See more details on using hashes here.

Provenance

The following attestation bundles were made for num2label-1.0.0.post1-py3-none-any.whl:

Publisher: python-publish.yml on ethanbradley/num2label

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