Python | Pandas TimedeltaIndex.notnull

Python | Pandas TimedeltaIndex.notnull

The TimedeltaIndex.notnull() method is used with a TimedeltaIndex object in pandas to determine which elements are not null (or NaT). This method returns a boolean array of the same length as the TimedeltaIndex, indicating whether each element is not null.

Here's a brief demonstration of how to use the TimedeltaIndex.notnull() method:

  1. Create a TimedeltaIndex object with some null values.
  2. Use the notnull() method to determine which values are not null.
import pandas as pd # Create a TimedeltaIndex with some null values tdi = pd.TimedeltaIndex(['1 days', pd.NaT, '3 days', pd.NaT, '5 days']) # Use the notnull() method result = tdi.notnull() print(result) 

Output:

[ True False True False True] 

As seen in the output, the notnull() method returns True for non-null (or non-NaT) values and False for null (or NaT) values.


More Tags

android-mapview return-value maven-2 nbconvert linq-group azure-devops-rest-api web-hosting google-drive-api ftp4j kerberos

More Programming Guides

Other Guides

More Programming Examples