Skip to main content

Библиотека для безопасной универсальной нормализации альтернативных форматов ввода числовых данных — как в виде чисел, так и в виде строк с числовыми значениями — к стандартам записи чисел в Python и типизации их в int или float, а для случаев, когда входные данные не являются числовыми, библиотека гарантирует возврат данных с сохранением исходного типа и значения.

Project description

numnorm

Под английским - на русском :-)


The library provides safe and universal normalization of alternative input formats for numerical data. It handles both direct numeric values and string representations of numbers, bringing them into compliance with Python’s number notation standards and converting them to int or float types. At the same time, for data that are not numeric, the library guarantees preservation of the original data type and value — no information loss occurs. The library is robust when processing input data of various classes: str, int, float, list, tuple, dict, set, bool, complex, object — none of these types will cause an error during its operation.

The code below provides some examples of alternative number input formats, both numeric and string, that the library can correctly process, normalize, and convert to the appropriate data type.

from numnorm import norm

num_1 = 4/2
num_2 = -0.0
num_3 = '-,5'
num_4 = '+000,000'
num_5 = '-123,0'
num_6 = '+123,500'
print (num_1, type(num_1), norm(num_1), type(norm(num_1)))
print (num_2, type(num_2), norm(num_2), type(norm(num_2)))
print (num_3, type(num_3), norm(num_3), type(norm(num_3)))
print (num_4, type(num_4), norm(num_4), type(norm(num_4)))
print (num_5, type(num_5), norm(num_5), type(norm(num_5)))
print (num_6, type(num_6), norm(num_6), type(norm(num_6)))

Output:

     2.0 <class 'float'>    2 <class 'int'>
    -0.0 <class 'float'>    0 <class 'int'>
     -,5 <class 'str'>   -0.5 <class 'float'>
+000,000 <class 'str'>      0 <class 'int'>
  -123,0 <class 'str'>   -123 <class 'int'>
+123,500 <class 'str'>  123.5 <class 'float'>

Usage

Import the norm unction from the numnorm library:

from numnorm import norm

Accessing the function:

result = norm(data)

where:
      data   - input data to be processed;
      result - processing result of the input data.

Installation

Install the package using pip:

pip install numnorm

Moscow, Russia, 2025
Maxim Y. Klimkov, +7 (916) 386-38-32, Klimkov@inbox.ru



Библиотека обеспечивает безопасную и универсальную нормализацию альтернативных форматов ввода числовых данных. Она работает как с непосредственными числовыми значениями, так и со строковыми представлениями чисел, приводя их к стандартам записи чисел в Python и преобразуя в типы int или float. При этом для данных, которые не являются числовыми, библиотека гарантирует сохранение исходного типа и значения — никакой потери информации не происходит. Библиотека устойчива к входным данным различных классов: str, int, float, list, tuple, dict, set, bool, complex, object — ни один из этих типов не приведёт к возникновению ошибки в процессе её работы.

В коде ниже представлены некоторые примеры альтернативных форматов ввода чисел — как в числовом, так и в строковом виде, — которые библиотека способна корректно обработать, нормализовать и привести к соответствующему типу данных.

from numnorm import norm

num_1 = 4/2
num_2 = -0.0
num_3 = '-,5'
num_4 = '+000,000'
num_5 = '-123,0'
num_6 = '+123,500'
print (num_1, type(num_1), norm(num_1), type(norm(num_1)))
print (num_2, type(num_2), norm(num_2), type(norm(num_2)))
print (num_3, type(num_3), norm(num_3), type(norm(num_3)))
print (num_4, type(num_4), norm(num_4), type(norm(num_4)))
print (num_5, type(num_5), norm(num_5), type(norm(num_5)))
print (num_6, type(num_6), norm(num_6), type(norm(num_6)))

Результат:

     2.0 <class 'float'>    2 <class 'int'>
    -0.0 <class 'float'>    0 <class 'int'>
     -,5 <class 'str'>   -0.5 <class 'float'>
+000,000 <class 'str'>      0 <class 'int'>
  -123,0 <class 'str'>   -123 <class 'int'>
+123,500 <class 'str'>  123.5 <class 'float'>

Использование:

Импортируйте функцию norm из библиотеки numnorm :

from numnorm import norm

Обращение к функции:

result = norm(data)

где:
    data   - исходные данные для обработки;
    result - результат обработки исходных данных.

Установка

Установите пакет через pip:

pip install numnorm

Москва, Россия, 2025
Климков Максим, +7 (916) 386-38-32, Klimkov@inbox.ru


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

numnorm-1.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

numnorm-1.1.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file numnorm-1.1.1.tar.gz.

File metadata

  • Download URL: numnorm-1.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for numnorm-1.1.1.tar.gz
Algorithm Hash digest
SHA256 3a15e06779cdf66c2b21d74a4616d3b97f3ee208927d98d8f34f49b20766eadb
MD5 264df1d74abb3591c1835b37dc60a6bb
BLAKE2b-256 cc4a194b633167f4c66ac7ac346b58cc5f05efde4eab4e2725c2edfdcd7728bc

See more details on using hashes here.

File details

Details for the file numnorm-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: numnorm-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for numnorm-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a1fc771e0df5e57c0de8d27c99309a0c0a3bc0ab2c9c9ae717bb97bd8d8bb8a7
MD5 d71ceda08ff578ce6a14d020c8fc7f06
BLAKE2b-256 d3b798ae5b73ada470e13f5d1acd3b54b51a28253e999c550121605052686ea5

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