Comparison to `None` will result in an elementwise object

You are looking for is:

if a is None:
    a = something else

The problem is that, by using the == operator, if the input element a is a numpy array, numpy will try to perform an element wise comparison and tell you that you cannot compare it.

For a a numpy array, a == None gives error, np.all(a == None) doesn’t (but does not do what you expect). Instead a is None will work regardless the data type of a.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)