I have a dataframe with a datetime index and then I try to convert it to json using to_json() I get an error saying:
ValueError: DataFrame index must be unique for orient='columns'
However my index column should have unique values. I tried df.duplicates() and got this:
time
2018-01-28 False
2018-02-04 False
2018-02-11 False
2018-02-18 False
2018-02-25 False
...
2019-12-29 False
2020-01-05 False
2020-01-12 False
2020-01-19 True
2020-01-26 False
Length: 112, dtype: bool
You can clearly see that the second to last column is marked as a duplicate when it's not. I also tried drop_duplicates(keep='last') but I still got the same error.
Why is this happening?