Python Pandas TimedeltaIndex.resolution
Python是一种进行数据分析的伟大语言,主要是因为以数据为中心的Python包的奇妙生态系统。Pandas就是这些包中的一个,它使导入和分析数据变得更加容易。
Pandas TimedeltaIndex.resolution属性返回一个字符串,代表我们对给定TimedeltaIndex对象的最低分辨率。
语法 : TimedeltaIndex.resolution
返回:字符串
例子#1:使用TimedeltaIndex.resolution属性来找出给定对象的最低可用分辨率。
# importing pandas as pd
import pandas as pd
# Create the TimedeltaIndex object
tidx = pd.TimedeltaIndex(start ='1 days 02:00:12.001124', periods = 5,
freq ='N', name ='Koala')
# Print the TimedeltaIndex
print(tidx)
输出 :
现在我们将找到我们对给定对象的最低分辨率。
# return the lowest resolution available for the tidx object
tidx.resolution
输出 :
正如我们在输出中看到的,TimedeltaIndex.resolution属性已经返回 “纳秒 “作为给定tidx对象的最低可用分辨率。
例子#2:使用TimedeltaIndex.resolution属性来找出给定对象的最低可用分辨率。
# importing pandas as pd
import pandas as pd
# Create the TimedeltaIndex object
tidx = pd.TimedeltaIndex(data =['-1 days 2 min 3us 10ns', '1 days 06:05:01.000030',
'-1 days + 23:59:59.999999'])
# Print the TimedeltaIndex
print(tidx)
输出 :
现在我们将找到我们对给定对象的最低分辨率。
# return the lowest resolution available for the tidx object
tidx.resolution
输出 :
正如我们在输出中看到的,TimedeltaIndex.resolution属性已经返回了’day’作为给定tidx对象的最低分辨率。