Python | numpy.isnat() method (original) (raw)
Last Updated : 27 Sep, 2019
With the help of **numpy.isnat()**
method, we can get the boolean value as true if date defined in a np.datetime64()
method is not a time by using numpy.isnat()
method.
Syntax :
numpy.isnat()
Return : Return the boolean value if time is not found.
Example #1 :
In this example we can see that by using numpy.isnat()
method, we are able to get the boolean value if time is not found in np.datetime64()
method.
import
numpy as np
gfg
=
np.isnat(np.datetime64(
"Nat"
))
print
(gfg)
Output :
True
Example #2 :
import
numpy as np
gfg
=
np.isnat(np.datetime64(
"1998-01-01"
))
print
(gfg)
Output :
False
Similar Reads
- Python | numpy.isin() method With the help of numpy.isin() method, we can see that one array having values are checked in a different numpy array having different elements with different sizes. Syntax : numpy.isin(target_array, list) Return : Return boolean array having same size as of target_array. Example #1 : In this example 1 min read
- Python | Numpy np.can_cast() method With the help of np.can_cast() method, we can get the perfect idea that one data type can be able to cast into another data type or not by using np.can_cast() method. Syntax : np.can_cast(source data_type, target data_type) Return : Return the boolean value as true when casting can be done else fals 1 min read
- Python | numpy.lookfor() method With the help of numpy.lookfor() method, we can get the information about the module in the numpy by using numpy.lookfor() method. Syntax : numpy.lookfor(module_name) Return : Return the information about the module. Example #1 : In this example we can see that by using numpy.lookfor() method, we ar 1 min read
- Python | numpy.assert_allclose() method With the help of numpy.assert_allclose() method, we can get the assertion errors when two array objects are not equal upto the mark by using numpy.assert_allclose(). Syntax : numpy.assert_allclose(actual_array, desired_array) Return : Return the Assertion error if two array objects are not equal. Ex 1 min read
- Numpy count_nonzero method | Python numpy.count_nonzero() function counts the number of non-zero values in the array arr. Syntax : numpy.count_nonzero(arr, axis=None) Parameters : arr : [array_like] The array for which to count non-zeros. axis : [int or tuple, optional] Axis or tuple of axes along which to count non-zeros. Default is 1 min read
- numpy.nonzero() in Python numpy.nonzero()function is used to Compute the indices of the elements that are non-zero. It returns a tuple of arrays, one for each dimension of arr, containing the indices of the non-zero elements in that dimension. The corresponding non-zero values in the array can be obtained with arr[nonzero(ar 2 min read
- numpy.isnan() in Python The numpy.isnan() function tests element-wise whether it is NaN or not and returns the result as a boolean array. Syntax : numpy.isnan(array [, out]) Parameters : array : [array_like]Input array or object whose elements, we need to test for infinity out : [ndarray, optional]Output array placed with 2 min read
- Python | sympy.is_number method With the help of sympy.is_number method, we can check if element is number or not and it will return a boolean value if number is found by using sympy.is_number method. Syntax : sympy.is_number Return : Return a boolean value if number is found. Example #1 : In this example we can see that by using 1 min read
- Python hasattr() method Python hasattr() function is an inbuilt utility function, which is used to check if an object has the given named attribute and return true if present, else false. In this article, we will see how to check if an object has an attribute in Python. Syntax of hasattr() function Syntax : hasattr(obj, ke 2 min read
- numpy.index() in Python numpy.core.defchararray.index(arr, substring, start=0, end=None): Finds the lowest index of the sub-string in the specified range But if substring is not found, it raises ValueError. Parameters: arr : array-like or string to be searched. substring : substring to search for. start, end : [int, option 1 min read