Python是進行數據分析的一種出色語言,主要是因為以數據為中心的python軟件包具有奇妙的生態係統。 Pandas是其中的一種,使導入和分析數據更加容易。
 Pandas  Period.freqstr屬性返回應用於給定Period對象的時間序列頻率的字符串別名。
用法: Period.freqstr
參數:沒有
返回:串
範例1:采用Period.freqstr 屬性以查找應用於給定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.freqstr屬性以查找應用於prd對象的頻率的字符串別名。
# return the string alias of the frequency 
prd.freqstr輸出:

正如我們在輸出中看到的,Period.freqstr 屬性返回了“ D”,表示應用於給定對象的時間序列頻率為day。
範例2:采用Period.freqstr屬性以查找應用於給定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.freqstr屬性以查找應用於prd對象的頻率的字符串別名。
# return the string alias of the frequency 
prd.freqstr輸出:

正如我們在輸出中看到的,Period.freqstr 屬性返回了“ Q-DEC”,表明應用於給定對象的時間序列頻率是該年度的結束季度。
相關用法
- Python pandas.map()用法及代碼示例
 - Python Pandas Series.str.len()用法及代碼示例
 - Python Pandas.factorize()用法及代碼示例
 - Python Pandas TimedeltaIndex.name用法及代碼示例
 - Python Pandas dataframe.ne()用法及代碼示例
 - Python Pandas Series.between()用法及代碼示例
 - Python Pandas DataFrame.where()用法及代碼示例
 - Python Pandas Series.add()用法及代碼示例
 - Python Pandas.pivot_table()用法及代碼示例
 - Python Pandas Series.mod()用法及代碼示例
 - Python Pandas Dataframe.at[ ]用法及代碼示例
 - Python Pandas Dataframe.iat[ ]用法及代碼示例
 - Python Pandas.pivot()用法及代碼示例
 - Python Pandas dataframe.mul()用法及代碼示例
 - Python Pandas.melt()用法及代碼示例
 
注:本文由純淨天空篩選整理自Shubham__Ranjan大神的英文原創作品 Python | Pandas Period.freqstr。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
