Python Pandas TimedeltaIndex.dtype_str
Python是一种进行数据分析的伟大语言,主要是因为以数据为中心的Python包的奇妙生态系统。Pandas就是这些包中的一个,它使导入和分析数据变得更加容易。
Pandas TimedeltaIndex.dtype_str属性以字符串形式返回TimedeltaIndex对象的数据类型。
语法: TimedeltaIndex.dtype_str
返回: dtype
示例#1:使用TimedeltaIndex.dtype_str属性来查找给定TimedeltaIndex对象的字符串格式的数据类型。
# 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'])
# Print the TimedeltaIndex
print(tidx)
输出 :
现在我们想找出字符串格式的TimedeltaIndex对象的数据类型。
# return the data type of the values
# in the given object in string format
tidx.dtype_str
输出 :
正如我们在输出中看到的,TimedeltaIndex.dtype_str已经以字符串格式返回了tidx对象中数值的基本数据类型。
示例#2:使用TimedeltaIndex.dtype_str属性来查找给定TimedeltaIndex对象的字符串格式的数据类型。
# 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)
输出 :
现在我们想找出字符串格式的TimedeltaIndex对象的数据类型。
# return the data type of the values
# in the given object in string format
tidx.dtype_str
输出 :
正如我们在输出中看到的,TimedeltaIndex.dtype_str已经以字符串格式返回了tidx对象中数值的基本数据类型。