Python Pandas Period.end_time
Python是一种进行数据分析的伟大语言,主要是因为以数据为中心的Python包的奇妙生态系统。Pandas就是这些包中的一个,它使导入和分析数据变得更加容易。
Pandas Period.end_time属性返回一个包含给定周期对象结束时间的Timestamp对象。
语法 :
Period.end_time
参数:无
返回:时间戳对象
示例#1:使用Period.end_time属性来查找给定的Period对象的结束时间。
# importing pandas as pd
import pandas as pd
# Create the Period object
prd = pd.Period(freq ='D', year = 2001, month = 2, day = 21)
# Print the Period object
print(prd)
输出 :

现在我们将使用Period.end_time属性来查找prd对象的结束时间。
# return the end time
prd.end_time
输出 :

正如我们在输出中看到的,Period.end_time属性返回了一个Timestamp对象,其中包含了日期值以及给定时间的结束时间。
示例#2:使用Period.end_time属性来查找给定的Period对象的结束时间。
# importing pandas as pd
import pandas as pd
# Create the Period object
prd = pd.Period(freq ='Q', year = 2006, quarter = 1)
# Print the object
print(prd)
输出 :

现在我们将使用Period.end_time属性来查找prd对象的结束时间。
# return the end time
prd.end_time
输出 :

正如我们在输出中看到的,Period.end_time属性返回了一个Timestamp对象,其中包含了日期值以及给定周期对象的结束时间。
极客教程