4
我想在每天的股票價格關閉的數據幀來選擇每個星期五。我已閱讀並試圖建議在this link,具體如下:數據框中行選擇的指數的平日在Python
Fridays = df[df.index.weekday == 4] #Fridays
,但我得到了以下錯誤:
AttributeError: 'Index' object has no attribute 'weekday'
<class 'pandas.core.frame.DataFrame'>
我相信這個問題是Python沒有索引識別字符串作爲日期,但我想不出爲什麼。 DataFrame看起來像這樣:
1993-04-08 3387.83
1993-04-12 3420.79
任何幫助表示讚賞。
謝謝 - 那工作。我感謝幫助! – user2719480