Q: numpy - what is the definition of null value or null column? Question
There are references of null such as null value or null column, but what is null in numpy? Is it the same with numpy.NaN or something else? Is null column a column which all values are NaN or one of the values is NaN?

*

*setting null values in a numpy array

*100 numpy exercises - 60. How to tell if a given 2D array has null columns?
Or is it the same with None?
a = np.array([
    ("one", "first"),
    (None, "fourth")
])
----
array([['one', 'first'],
       [None, 'fourth']], dtype=object)

If I follow the answer of 60. How to tell if a given 2D array has null columns?, np.zeros() includes null value as it results in True (there is null column). Then null is also zero in numpy?
a = np.zeros((3,3))
print((~a.any(axis=0)).any())
---
True


A: Let me start by describing each type -
np.NaN dtype - This is a float type class. Numpy follows IEEE 754 standards to represent their numbers. According to this document. NaN is an undefined number. For example, log(-1), sqrt(-1), 0*inf, 0/0 All these belong to the category of not a number. These operations will return a NaN.
>>> np.log(-1)
nan
>>> np.sqrt(-1)
nan
>>> 0*np.inf
nan

NaN does not mean inf or 0. Expressing any digit beyond the capacity of the Numpy array leads to the following behavior.
>>> x = np.array([1e-50], dtype=np.float32)
>>> x
array([0.], dtype=float32)
>>> x = np.array([1e50], dtype=np.float32)
>>> x
array([inf], dtype=float32)
>>> np.inf == np.NaN
False
>>> 0.0 == np.NaN
False

Now, what is the difference between None and np.NaN.
In Python None is a keyword. It has its own type NoneType.
It can be thought of as the null of Python. In other languages, we use 0 or some other number to represent null. In python we do not do so, we use an entirely new data type called NoneType. By default None is "falsy" which means evaluating if not None returns True. Just like an empty list, empty dictionary, empty string, 0.
>>> not None
True
>>> not []
True
>>> not 0
True

As I see your question, None seems like a good choice but beware that you have to keep your dtype as object. This is because you have two different types string and Nonetype inside the same array. These 2 types are child of the parent class object that you have defined in your array. This will have memory overheads. Having the same data type helps NumPy allocate memory efficiently, improve execution speed. Therefore, if you define an array like np.empty([]) it populates it with a float value 0. Which functions like a null value. Look at the following example -
>>> np.empty((1,2), dtype=object)
array([[None, None]], dtype=object) 
>>> np.empty((1,2), dtype=np.float32)
array([[1.60e-43, 1.54e-43]], dtype=float32) # this is 0,0

References -

*

*IEEE 754 wikipedia

*Numpy NaN
