I have a following date frame.
mydf = pd.DataFrame({'month':[2,3,7,8],'day':[29,24,20,29]})
>>> mydf
day month
0 29 2
1 24 3
2 20 7
3 29 8
>>> leapdf = mydf.loc[(mydf['month'] == 2) & (mydf['day'] == 29) ]
>>> leapdf
day month
0 29 2
>>> otherdf = mydf.loc[(mydf['month'] != 2) & (mydf['day'] != 29) ]
>>> otherdf
day month
1 24 3
2 20 7
Above otherdf I am expecting day 29 and month 8 to be included. But not included. Can any one guide me what is the error.
Thanks
(mydf['day'] != 29). Your filter removes all months of Feb and all days (regardless of month) equal to day 29.