I am trying to find the min() value between two points using between_time. I have created two columns that I would like to use as my start and end time to find the minimum value and add the output to a new column:
This is a snip of the df:
df[['Date_Time','d1_idx_last','Low']]
Date_Time d1_idx_last Low
Timestamp
2015-09-01 09:30:00.000 2015-09-01 09:30:00.000 2015-09-01 16:14:51.000 1887.750
2015-09-01 09:30:01.000 2015-09-01 09:30:01.000 2015-09-01 16:14:51.000 1888.250
2015-09-01 09:30:01.200 2015-09-01 09:30:01.200 2015-09-01 16:14:51.000 1888.000
2015-09-01 09:30:10.100 2015-09-01 09:30:10.100 2015-09-01 16:14:51.000 1889.250
2015-09-01 09:30:11.100 2015-09-01 09:30:11.100 2015-09-01 16:14:51.000 1889.500
I am trying to use this code:
df.Low.between_time(df.Date_Time, df.d1_idx_last, include_start=True, include_end=True)
and get this error:
Cannot convert arg [1441099800000000000 1441099801000000000 1441099801200000000 ...,
1470924200100000000 1470924369230000000 1470924793157000000] to a time
The columns 'Date_Time' & 'd1_idx_last' are both type pandas.tslib.Timestamp.
Update to clarify:
So if we look at the first row it shows
'Date_Time' 2015-09-01 09:30:00.000
'd1_idx_last'2015-09-01 16:14:51.000
On this row the time between 'Date_Time' & 'd1_idx_last' captures a full trading day (09:30-16:15) and I want the low of the time between these two points.
On this day the market went as low as 1863.500 so that would be the min value for (09:30-16:15).
df[['Low']]['2015-09-01'].min()
Low 1863.500
dtype: float64
If the low of 1863.500 came at 13:00 the rolling low would be higher after this point.
I want a new column called df['subset_low'] that checks 'Date_Time' & 'd1_idx_last' on each row and finds the low between this period and adds it to df['subset_low']. It is checking the current time and the last point of the day and showing what the low will be between this time.
Another example for @Maxu using fake data in the Low and (desired) subset_low columns:

between_timescalar values - not a Series object...applyto implement on a per row basis? Can anyone help fix my code please?