Numpy NaN is the IEEE 754 floating-point representation of Not a Number (NaN). NaN values are constants defined in numpy: nan, inf. NaNs can be used as the poor-man’s mask (if you don’t care what the original value was). Python NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754) what this means is that Not a Number is not equivalent to infinity. The NaN and NAN are aliases of nan.

Numpy NaN Example
NaN stands for “not a number,” and its primary constant is to act as a placeholder for any missing numerical values in the array. While we already covered a couple of different ways to handle NaN values I would like to go into the little more depth on some of the NaN functions in the NumPy.

The majority of the data you will be working with will be given to you. As we have seen when we use Pandas to import DataFrame, any missing value is automatically replaced with NaN as a placeholder. But we can also mimic the same behavior directly in NumPy.

#python #nan constants #numpy nan

Numpy NaN Example - NaN Constants in Numpy Explanied
3.00 GEEK