Friday, January 30, 2026
HomeLanguagesPython | Pandas TimedeltaIndex.inferred_type

Python | Pandas TimedeltaIndex.inferred_type

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.inferred_type attribute return an inferred type for the object on which it is applied.

Syntax: TimedeltaIndex.inferred_type

Return : inferred_type

Example #1: Use TimedeltaIndex.inferred_type attribute to infer the type of the TimedeltaIndex object.




# 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 guess the type of the given TimedeltaIndex object.




# return the inferred type of the tidx object
tidx.inferred_type


Output :

As we can see in the output, the TimedeltaIndex.inferred_type attribute has returned ‘timedelta64’ type for tidx object.
 
Example #2: Use TimedeltaIndex.inferred_type attribute to infer the type of the TimedeltaIndex object.




# 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 guess the type of the given TimedeltaIndex object.




# return the inferred type of the tidx object
tidx.inferred_type


Output :

As we can see in the output, the TimedeltaIndex.inferred_type attribute has returned ‘timedelta64’ type for tidx object.

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

Most Popular

Dominic
32478 POSTS0 COMMENTS
Milvus
122 POSTS0 COMMENTS
Nango Kala
6849 POSTS0 COMMENTS
Nicole Veronica
11978 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12065 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7222 POSTS0 COMMENTS
Thapelo Manthata
6934 POSTS0 COMMENTS
Umr Jansen
6917 POSTS0 COMMENTS