I have the following timeserie:
start = pd.to_datetime(\'2016-1-1\')
end = pd.to_datetime(\'2016-1-15\')
rng = pd.date_range(start, end, freq=\'2h\')
df = pd.Dat
Another one to try. Exclude the dates in the date_range
:
Edit: Added frequency to date_range
. This is now the same as original data.
dropThis = pd.date_range(start_remove,end_remove,freq='2h')
df[~df.index.isin(dropThis)]
We can see the rows are now dropped.
len(df)
169
len(df[~pd.to_datetime(df.index).isin(dropThis)])
120