Skip to main content

nanto makes working with values that might be NaN safer and easier

Project description

nanto

https://img.shields.io/pypi/v/nanto.svg https://img.shields.io/travis/mmore500/nanto.svg Documentation Status

nanto makes working with values that might be NaN safer and easier

from nanto import isanan, nantonone, nantozero


isanan(7.0) # False
isanan('string') # False
isanan(None) # False
isanan(float('nan')) # True


nanto(float('nan'), 'fallback') # returns 'fallback'
nanto(1.7, 'fallback') # returns 1.7
nanto(float('inf'), 'fallback') # returns inf
nanto(None, 'fallback') # returns None
nanto('hello', 'fallback') # returns 'hello'


nantonone(float('nan')) # returns None
nantonone(1.7) # returns 1.7
nantonone(float('inf')) # returns inf
nantonone(None) # returns None
nantonone('hello') # returns 'hello'


nantozero(float('nan')) # returns 0
nantozero(1.7) # returns 1.7
nantozero(float('inf')) # returns inf
nantozero(None) # returns None
nantozero('hello') # returns 'hello'

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.0.0 (2022-02-22)

  • First release on PyPI.

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

nanto-0.1.1.tar.gz (10.2 kB view hashes)

Uploaded Source

Built Distribution

nanto-0.1.1-py2.py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page