Reputation: 43
I am trying to select every Friday in a dataframe of daily stock price closes. I read and tried the suggestion in this link, specifically:
Fridays = df[df.index.weekday == 4] #Fridays
but I get the following error:
AttributeError: 'Index' object has no attribute 'weekday'
<class 'pandas.core.frame.DataFrame'>
I believe the issue is that Python does not recognize the strings in the index as dates, but I can't figure out why. The DataFrame looks like this:
1993-04-08 3387.83
1993-04-12 3420.79
Any help is appreciated.
Upvotes: 4
Views: 1056