Skip to main content

str2float

There are 3 ways to group the number ten thousand with digit group separators:

  1. Space: the internationally recommended thousands separator.
  2. Point: the thousands separator used in many non-English speaking countries.
  3. Comma: the thousands separator used in most English-speaking countries.

thousands separators


In which, there are 2 types of decimal separators:

  1. Decimal point
  2. Decimal comma

decimal separators


This package will help convert float string (decimal point or decimal comma) to float!

Installation:

https://pypi.org/project/str2float/

pip install str2float

Usage:

from str2float import str2float
float = str2float(str_float)

Example:

from str2float import str2float


if __name__ == "__main__":
    assert str2float("1") == 1.0
    assert str2float("1.2345") == 1.2345
    assert str2float("1.23") == 1.23
    assert str2float("1.2") == 1.2
    assert str2float("1,2345") == 1.2345
    assert str2float("1,23") == 1.23
    assert str2float("1,2") == 1.2
    assert str2float("1234,5") == 1234.5
    assert str2float("1.234,5") == 1234.5
    assert str2float("1,234.5") == 1234.5
    assert str2float("1,234,567.85") == 1234567.85
    assert str2float("1.234.567,85") == 1234567.85

From hoangyell with love 😘

Release files for str2float 0.0.9

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

Source distribution (sdist)

Source distribution for str2float 0.0.9
File Size Uploaded
str2float-0.0.9.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for str2float 0.0.9
File Interpreter ABI Platform
str2float-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 6.1 kB

Release files / str2float-0.0.9.tar.gz

Download URL str2float-0.0.9.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
097eee4adbbd101e45feb2675caebf995fa783d1d4c4f01e912ed2f79f050d7e
BLAKE2b-256 checksum
How to use checksums
871c3732153def4dca25a9d42df4b3c68f9620ac179bca2faa2bd553316b3381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / str2float-0.0.9-py3-none-any.whl

Download URL str2float-0.0.9-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6aa194116dc8c995e6740e3bd01b804fe1d1e9e3dbb11deb921d9b9cdb973eb1
BLAKE2b-256 checksum
How to use checksums
70091422e6f550147dcea8e20d3d390dd9489f13e5a33abc9692a29ede9e1560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

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