I am running a script (script 1) to create an empty data frame which is populated by another script (script 2). The index in this empty data frame is a time series of 30 minute intervals across 365 days, beginning 1st October 2016. To create this time series index, Script 1 contains the following code:
time_period_start = dt.datetime(2016,01,10).strftime("%Y-%d-%m")
index = pd.date_range(time_period_start, freq='30min', periods=17520)
.strftime() isn't affecting the final dataframe, since
pd.date_range transforms it back into a
datetime anyway. Instead of trying to match on strings, you should convert the dates in the second dataframe (the one created by Script 2) to
datetime as well.
df2.date = pd.to_datetime(df2.date, format='%Y-%d-%m')