Skip to main content

Función signif en Pyhton

Esta función te permite expresar cualquier número real con una determinada cantidad de cifras significativas de forma sencilla. Está inspirada en la función signif de R que realiza la misma tarea y de la cual hereda su nombre.

La función signif(x, n) redondea el valor de su primer argumento x, al número de cifras significativas especificado en su segundo argumento n. Concretamente realiza la operación round(x, n-int(math.floor(math.log10(abs(x))))-1).

El argumento x debe ser de tipo int o float mientras que el argumento n debe ser de tipo int.

Instalación

pip install significant-figures==0.0.4

Librería en PyPI

Ejemplo de uso

In[ ]:

from significant_figures import signif

signif(0.00047923, 2)

Out[ ]:

0.00048

Sobre el autor

GitHub

LinkedIn

Metadata

Release files for significant-figures 0.0.4

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

Source distribution (sdist)

Source distribution for significant-figures 0.0.4
File Size Uploaded
significant_figures-0.0.4.tar.gz 2.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for significant-figures 0.0.4
File Interpreter ABI Platform
significant_figures-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 4.2 kB

Release files / significant_figures-0.0.4.tar.gz

Download URL significant_figures-0.0.4.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e6431587ab843d0d73e35d1b594f1823c1dd20143323155e4c359417f8eb7baf
BLAKE2b-256 checksum
How to use checksums
e9e49c1e2873cc5a9344509f45a5210ce08d50da6dc5f1803af5fefc089732b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.5

Release files / significant_figures-0.0.4-py3-none-any.whl

Download URL significant_figures-0.0.4-py3-none-any.whl
Size 2.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c15bc96eb8d92e95f51ee3a5a8c2ca3892b904f72b0b9dd7ccf863e41423eac1
BLAKE2b-256 checksum
How to use checksums
150226e04688bb0fc76cba8f5dd2a243be00ac368673ff01ae527ca66d9c4ca5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

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