Conversion Of Daily Pandas Dataframe To Minute Frequency Incorrectly Fills Dates
I am trying to convert a daily frequency dataframe to minute data, that is for each row, I want to have that combination of ticker and date repeated on minute basis, and in a previ
Solution 1:
So the solution below works for me, I simply create new column with the daily dates and after the conversion, I creaete a another daily column and only keep the rows where both match:
df['date_column']=pd.to_datetime(df.index.get_level_values(0))
df['date_column']=pd.to_datetime(df['date_column']).dt.date
...converting dataframe...
df['date_column2']=pd.to_datetime(df.index.get_level_values(0))
df['date_column2']=pd.to_datetime(df['date_column2']).dt.date
df=df[df['date_column']==df['date_column2']]
Post a Comment for "Conversion Of Daily Pandas Dataframe To Minute Frequency Incorrectly Fills Dates"