Upsampling datetime - ValueError: cannot reindex a non-unique index with a method or limit

Viewed 2502

I get the error below when I try to upsample...

import pandas as pd
from datetime import date

df1=pd.read_csv("C:/Codes/test.csv")
df1['Date'] =  pd.to_datetime(df1['Date'])
df1 = df1.set_index(['Date'])
df2 = pd.DataFrame()
df2 = df1.Gen.resample('H').ffill()

I get this error...ValueError: cannot reindex a non-unique index with a method or limit. Please advise.

My test.csv is a simple file with two columns containing these 5 records

Date|Gen ----|---- 5/1/2017|Ggulf 5/2/2017|Ggulf 5/1/2017|Nelson 5/3/2017|Ggulf 5/4/2017|Nelson

1 Answers
Related