📜  Python|熊猫 Period.end_time

📅  最后修改于: 2022-05-13 01:55:40.729000             🧑  作者: Mango

Python|熊猫 Period.end_time

Python是一种用于进行数据分析的出色语言,主要是因为以数据为中心的Python包的奇妙生态系统。 Pandas就是其中之一,它使导入和分析数据变得更加容易。

Pandas Period.end_time属性返回一个 Timestamp 对象,其中包含给定期间对象的结束时间。

示例 #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 对象,其中包含给定期间对象的日期值和结束时间。