Snippets Collections
YouTubeDropperButton.Run(varSplitText, (If(IsBlank(Notes.HtmlText), "", Notes.HtmlText)))
import math
import numpy as np
import pandas as pd

def nully(obj: any) -> bool:
    """Checks for all kinds of NaN, NaT and None
    Args:
        obj[any]: Object to check
    Returns:
        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
    ]
    try:
        conditions.append(math.isnan(obj)) # python NaN
    except TypeError: # not a number type
        pass
    if any(conditions):
        return True
    return False
star

Fri Apr 29 2022 12:18:01 GMT+0000 (Coordinated Universal Time)

#python #null

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension