當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Pandas PeriodIndex.end_time用法及代碼示例

Python是進行數據分析的一種出色語言,主要是因為以數據為中心的python軟件包具有奇妙的生態係統。 Pandas是其中的一種,使導入和分析數據更加容易。

Pandas PeriodIndex.end_time屬性返回一個Index對象。索引包含給定PeriodIndex對象中每個元素的時間段的結束時間。

用法: PeriodIndex.end_time

參數:沒有

返回:指數

範例1:采用PeriodIndex.end_time屬性,以查找給定PeriodIndex對象中每個元素的周期結束時間。

# importing pandas as pd 
import pandas as pd 
  
# Create the PeriodIndex object 
pidx = pd.PeriodIndex(start ='2005-12-21 08:45 ', 
              end ='2005-12-21 11:55', freq ='H') 
  
# Print the PeriodIndex object 
print(pidx)

輸出:

現在我們將使用PeriodIndex.end_time屬性以查找給定對象中每個元素的周期結束時間。

# return the end time of period 
pidx.end_time

輸出:

正如我們在輸出中看到的,PeriodIndex.end_time屬性已返回一個Index對象,其中包含給定PeriodIndex對象中每個元素的周期結束時間。

範例2:采用PeriodIndex.end_time屬性,以查找給定PeriodIndex對象中每個元素的周期結束時間。

# importing pandas as pd 
import pandas as pd 
  
# Create the PeriodIndex object 
pidx = pd.PeriodIndex(start ='2011-02-14 04:30',  
             end ='2011-02-14 11:44', freq ='H') 
  
# Print the PeriodIndex object 
print(pidx)

輸出:

現在我們將使用PeriodIndex.end_time屬性以查找給定對象中每個元素的周期結束時間。

# return the end time of period 
pidx.end_time

輸出:

正如我們在輸出中看到的,PeriodIndex.end_time屬性已返回一個Index對象,其中包含給定PeriodIndex對象中每個元素的周期結束時間。



相關用法


注:本文由純淨天空篩選整理自Shubham__Ranjan大神的英文原創作品 Python | Pandas PeriodIndex.end_time。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。