I've tried this problem for hours and has no solution..
Below is intraday 5 min forex data - df. It is recorded every 5 mins every day. I have excluded weekends data since market is close on weekends.Here a weekend is defined as from Friday 5:00 pm - Sunday 5:00 pm.
Time OPEN CLOSE
216 2014-01-01 18:05:00 0.891975 0.892185
217 2014-01-01 18:10:00 0.892075 0.892090
...
210238 2015-12-31 23:55:00 1.000390 1.000390
210239 2016-01-01 00:00:00 1.000390 1.000390
A day is defined as from 11:00 am - 11:00 am. So when I say 2014-01-02, I am aggregating data from 2014-01-01 11:00 am to 2014-01-02 11:00 am. 2014-01-06(monday) will include data from two intervals: 1. 2014-01-03(friday) 11:00 - 17:00 2. 2014-01-05(sunday) 17:00 - 2014-01-06 11:00
I want to create a new column 'Date' to define the new "day" so by reading df.Time, the column will record which day it belongs to.
how would you approach this?
Time OPEN CLOSE Date
2014-01-03 14:05:00 0.891975 0.892185 2014-01-06
2014-01-05 17:00:00 0.892075 0.892090 2014-01-06
2014-01-06 11:00:00 0.892075 0.892090 2014-01-06
...
2015-12-31 23:55:00 1.000390 1.000390 2016-01-01
2016-01-01 00:00:00 1.000390 1.000390 2016-01-01
Aucun commentaire:
Enregistrer un commentaire