I have a Code which I run in Jupyter Notebook,
This is the resulting DataFrame output which I get :-
LOCATION DATE DAKOTA HURRI SPITFIRE
MyIdx
176 Duxford 10-Jul-2004 D H S
177 Cirencester 10-Jul-2004 D H S
178 Brize Nortn 10-Jul-2004 D H S
74 Shrivenham 10-Jun-2004 D H S
257 Campbletown 15-Aug-2004 D -- S
258 Sunderland 15-Aug-2004 D -- S
261 Scampton 15-Aug-2004 D -- S
200 Fairford 15-Jul-2004 D -- SS
22 Tilford 15-May-2004 D -- S
23 Abingdon 15-May-2004 D -- S
24 Hyde Heath 15-May-2004 D -- S
Could I Moderator tidy the output layout for me, if that is okay ?
These are the two key parts of the Code I am filtering Rows by Date with :-
(df3['DATE'].str.contains('-10$|15$'))
and
display.sort_values(by=['DATE'])
The First line of Code, is to filter the DataFrame Row Output by two days the 10th of the Month and the 15th.
it correctly outputs the earliest days in the DataFrame Output first, i.e. 10 before 15, but not in the month order I want :-
I want 10th June 2004 first then the 10th of July/s then the 15th of May's then the 15th of July Rows etc. How do I modify that line of Code, so that I can filter to get that order, without changing the index position of the Rows via code, which I know how to do ?
I mean add something to either lines of Code, so that the Earlier month with an the earlier day, is shown 'favoured' before the later month with the same day ? i.e. 10-Jun-2004 is shown before 10-Jul-2004 , 15-May-2004 is shown before 15-Jul-2004 Rows then. But still dates with day 10 , showing before day 15 Rows.
So the Rows shown, are in the Date Order Like this :-
10-Jun-2004
10-Jul-2004
15-May-2004
15-Jul-2004
15-Aug-2004
The Date output is from this line of Code :-
display['DATE']= pd.to_datetime(display['DATE']).dt.strftime('%d-%b-%Y')
Any help I could be given, would be much appreciated
Best Regards
Eddie Winch