Friday, September 5, 2025
HomeLanguagesPython | Pandas TimedeltaIndex.is_all_dates

Python | Pandas TimedeltaIndex.is_all_dates

Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.

Pandas TimedeltaIndex.is_all_dates attribute return a boolean value. It returns True if the TimedeltaIndex object contains only dates.

Syntax: TimedeltaIndex.is_all_dates

Return : boolean

Example #1: Use TimedeltaIndex.is_all_dates attribute to check if the TimedeltaIndex object contains only dates.




# importing pandas as pd
import pandas as pd
  
# Create the TimedeltaIndex object
tidx = pd.TimedeltaIndex(data =['1 days 02:00:00', 
                   '1 days 06:05:01.000030', None])
  
# Print the TimedeltaIndex
print(tidx)


Output :

Now we will check if the TimedeltaIndex object contains only date.




# check if tidx contains date
tidx.is_all_dates


Output :

As we can see in the output, the TimedeltaIndex.is_all_dates attribute has returned True indicating that tidx contain all date values.
 
Example #2: Use TimedeltaIndex.inferred_type attribute to check if the TimedeltaIndex object contains only dates.




# importing pandas as pd
import pandas as pd
  
# Create the TimedeltaIndex object
tidx = pd.TimedeltaIndex(data =['-1 days 2 min 3us', '1 days 06:05:01.000030',
                                                 '-1 days + 23:59:59.999999'])
  
# Print the TimedeltaIndex
print(tidx)


Output :

Now we will check if the TimedeltaIndex object contains only date.




# check if tidx contains date
tidx.is_all_dates


Output :

As we can see in the output, the TimedeltaIndex.is_all_dates attribute has returned True indicating that tidx contain all date values.

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS