I have a dateframe named Mj_rank, with date as Datetime and index which looks like this:
A B C ...
date
2016-01-29 False False True
2016-01-30 False False True
2016-02-01 True True True
....
2017-12-29 False True True
Currently, the data is daily, but I would like to resample the data into a new df that contains every 6 months nth.
Therefore I did:
Mj_rank_s = Mj_rank.resample('6M').asfreq().tail()
which gives me this output:
ValueError: cannot reindex from a duplicate axis
strangely enough, if I use other methods like max() or min() it works fine, but not "asfreq()".
I tried different ways based on existing stackoverflow suggestions like adding in front, but didn't work :
Mj_rank = Mj_rank.reset_index()
Mj_rank['date'] = pd.to_datetime(Mj_rank['date'])
Mj_rank = Mj_rank.set_index('date')
Thanks a lot!
Edit: Thanks to @jezrael he pointed out I had problems with duplicates using Mj_rank[Mj_rank.index.duplicated(keep=False)]