Would you help me with the following error:
ValueError: cannot reindex a non-unique index with a method or limit
Let's say I have a dataframe df
datetime A B C
2020-07-02 23:00:01 50 nan nan
2020-07-02 23:00:02 nan 60 nan
2020-07-02 23:00:11 nan nan 80
2020-07-02 23:14:01 nan nan 65
2020-07-02 23:15:01 nan 90 nan
2020-07-02 23:15:02 10 nan nan
2020-07-02 23:28:01 20 25 nan
2020-07-02 23:30:01 nan nan 80
What I am trying to achieve is the following output:
datetime A B C
2020-07-02 23:00:00 50 60 80
2020-07-02 23:15:00 10 90 65
2020-07-02 23:30:01 20 25 80
I tried this with the following code:
df.datetime = pd.to_datetime(dfinal.datetime)
resampledata = df.set_index("tijd").resample("15T").pad()
But I got an error probably due to not having unique datetime values.