nanto
raw JSON → 0.1.1 verified Fri May 01 auth: no python
nanto makes working with values that might be NaN safer and easier. It provides utilities to detect, handle, and avoid NaN pitfalls. Current version: 0.1.1. Release cadence: irregular.
pip install nanto Common errors
error ImportError: cannot import name 'nan' from 'nanto' ↓
cause nanto not installed or wrong import path.
fix
Install with 'pip install nanto' and use 'from nanto import nan'.
error AttributeError: module 'nanto' has no attribute 'coalesce' ↓
cause Outdated version of nanto (coalesce added later?).
fix
Upgrade to latest version with 'pip install --upgrade nanto'.
Warnings
gotcha The 'nan' sentinel is a singleton, but using 'is' for comparison may be unreliable across imports. Always use 'is_nan()' or 'not_nan()' for checking NaN values. ↓
fix Use 'is_nan(value)' instead of 'value is nan'.
deprecated No deprecations known; library is early stage.
breaking No breaking changes known yet.
Imports
- nan
from nanto import nan - is_nan
from nanto import is_nan - not_nan
from nanto import not_nan - coalesce
from nanto import coalesce - Equality
from nanto import Equality
Quickstart
from nanto import nan, is_nan, not_nan, coalesce, Equality
# Use nan as a sentinel value
result = nan
print(is_nan(result)) # True
print(not_nan(42)) # True
# Coalesce: return first non-nan value
value = coalesce(nan, nan, 5, nan)
print(value) # 5
# Use Equality enum for safe comparisons
from nanto import Equality
if Equality.NAN == Equality.NAN:
print("By convention, nan equals nan in nanto.")