import math
import numpy as np
import pandas as pd

def nully(obj: any) -> bool:
    """Checks for all kinds of NaN, NaT and None
        obj[any]: Object to check
        bool: True if obj is nully
    conditions: List[bool] = [
      obj is None, # python None
      obj is np.nan, # numpy NaN
      obj is pd.nan, # pandas NA,
      obj is pd.NaT # pandas NaT
        conditions.append(math.isnan(obj)) # python NaN
    except TypeError: # not a number type
    if any(conditions):
        return True
    return False
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter