Skip to content

mmore500/nanto

Repository files navigation

nanto

image

image

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published