nat = np.datetime64(\'NaT\') nat == nat >> FutureWarning: In the future, \'NAT == x\' and \'x == NAT\' will always be False. np.isnan(nat) >> TypeError:
Another way would be to catch the exeption:
def is_nat(npdatetime): try: npdatetime.strftime('%x') return False except: return True