libb.is_null

is_null(x)[source]

Check if value is null/None (pandas required).

For array-like inputs (list, numpy array), returns True only if ALL elements are null. This avoids the “ambiguous truth value” error that occurs when using pandas.isnull() on arrays in boolean contexts.

Parameters:

x – Value to check.

Returns:

True if value is null/None/NaN, or if array-like and all elements are null.

Return type:

bool

Example:

>>> import datetime
>>> import numpy as np
>>> assert is_null(None)
>>> assert not is_null(0)
>>> assert is_null(np.nan)
>>> assert not is_null(datetime.date(2000, 1, 1))
>>> assert is_null([])
>>> assert is_null([None, None])
>>> assert not is_null([1, 2, 3])
>>> assert not is_null([None, 1])