当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python numpy.isnat()用法及代码示例


借助numpy.isnat()方法,如果日期在np.datetime64()方法不是通过使用时间numpy.isnat()方法。

用法: numpy.isnat()
返回:Return the boolean value if time is not found.

范例1:
在这个例子中,我们可以通过使用numpy.isnat()方法,如果在中找不到时间,我们就能获得布尔值np.datetime64()方法。


# import numpy 
import numpy as np 
  
# using numpy.isnat() method 
gfg = np.isnat(np.datetime64("Nat")) 
  
print(gfg)

输出:

True

范例2:

# import numpy 
import numpy as np 
  
# using numpy.isnat() method 
gfg = np.isnat(np.datetime64("1998-01-01")) 
  
print(gfg)

输出:

False



相关用法


注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 Python | numpy.isnat() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。