3 ms·
So how does NaN in Python and NA in R relate to NULL? I know Python has the None type, but it's not the same as NaN. One of the most annoying things in Numpy is
by laichzeit0 8y ago
So how does NaN in Python and NA in R relate to NULL? I know Python has the None type, but it's not the same as NaN. One of the most annoying things in Numpy is that there is no way to indicate that an integer value is "missing", similar to NaN for floats. In R both integers and strings can be NA (if I remember correctly). So for numeric types at least, there is definitely the need to somehow indicate that a value is "missing".
- hurrrrr 8y agoNumpy has masked arrays [1]. Though I can't say how well they work. [1] https://docs.scipy.org/doc/numpy/reference/maskedarray.generic.html#rationale https://docs.scipy.org/doc/numpy/reference/maskedarray.gener...
- Nullabillity 8y agoNaN is not the same as None/null, and using it that way is asking for bugs. None/null is for missing/unknown values (which may be a reasonable thing in your domain), while NaN is for the result of an illegal/undefined operation (which is definitely a bug, such as division by 0).