Python | Pandas Index.dtype_str Last Updated : 10 Apr, 2024 Comments Improve Suggest changes Like Article Like Report Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.dtype_str attribute return the data type (dtype) of the underlying data of the given Index object as a string. Syntax: Index.dtype_str Parameter : None Returns : dtype as a string Example #1: Use Index.dtype_str attribute to find the dtype of the underlying data of the given Index object as a string. Python3 # importing pandas as pd import pandas as pd # Creating the index idx = pd.Index(['Jan', 'Feb', 'Mar', 'Apr', 'May']) # Print the index print(idx) Output : Index(['Jan', 'Feb', 'Mar', 'Apr', 'May'], dtype='object') Index.dtype_str attribute to find the data type of the underlying data of the given series object as a string. Python3 # return the dtype as a string result = idx.dtype_str # Print the result print(result) Output : object As we can see in the output, the Index.dtype_str attribute has returned the data of the underlying data of the given Index object as a string. Example #2 : Use Index.dtype_str attribute to find the dtype of the underlying data of the given Index object as a string. Python3 # importing pandas as pd import pandas as pd # Creating the index idx = pd.Index([100, 200, 142, 88, 124]) # Print the index print(idx) Output : Int64Index([100, 200, 142, 88, 124], dtype='int64') Now we will use Index.dtype_str attribute to find the data type of the underlying data of the given series object as a string. Python3 # return the dtype as a string result = idx.dtype_str # Print the result print(result) Output : int64 As we can see in the output, the Index.dtype_str attribute has returned the data of the underlying data of the given Index object as a string. Comment More infoAdvertise with us Next Article Python | Pandas Index.dtype_str S Shubham__Ranjan Follow Improve Article Tags : Python Pandas Python-pandas Python pandas-indexing AI-ML-DS With Python +1 More Practice Tags : python Similar Reads Python | Pandas Index.dtype Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.dtype attribute return the data type (dtype) of the underlying data of the given Index object. Syntax: Index.dtype Parameter : None Re 2 min read Python | Pandas Index.astype() 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 Index.astype() function create an Index with values cast to dtypes. The class o 2 min read Python | Pandas Index.data Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.data attribute return the data pointer of the underlying data of the given Index object. Syntax: Index.data Parameter : None Returns : 2 min read Python | Pandas Index.to_frame() 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 Index.to_frame() function create a dataFrame from the given index with a column 2 min read Python | Pandas Series.dtype 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 series is a One-dimensional ndarray with axis labels. The labels need not be un 2 min read Python | Pandas Index.tolist() 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 Index.tolist() function return a list of the values. These are each a scalar ty 1 min read Python | Pandas Index.copy() 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 Index.copy() function make a copy of this object. The function also sets the na 2 min read Python | Pandas Index.size Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.size attribute return the number of elements in the underlying data of the given Index object. Syntax: Index.size Parameter : None Ret 2 min read Python | Pandas Index.get_values() 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 Index.get_values() function returns the Index data as an numpy.ndarray. It retu 2 min read Like