This is very easy with RedBlackPy. It is available for macosx and linux for python 3.
import redblackpy as rb
from datetime import datetime
# do not keep Nat values, it is redundantly
# you can interpolate data with no add keys to container
index = [0.782296, 0.821426, 0.864383, 0.906240]
values = [datetime(2012, 11, 19, 12, 40, 10),
datetime(2012, 11, 19, 12, 35, 10),
datetime(2012, 11, 19, 12, 30, 10),
datetime(2012, 11, 19, 12, 25, 10) ]
# init Series with specific interpolation type (floor, ceil, nn, linear)
data = rb.Series(index=index, values=values, dtype='object',
interpolation='linear')
Now you can access by any key using interpolation!
# your index, where you wanted to interpolate
int_index = [0.795469, 0.834957]
# access to key that not in series
print( data[int_index[0]] ) # this prints 2012-11-19 12:38:29.005878
# you change interpolation type
data.set_interpolation('floor')
print( data[int_index[0]] ) # this prints 2012-11-19 12:40:10
If you want to add interpolated values to Series just use insert or setitem as follows:
# this add interpolation values to data
for el in int_index:
data[el] = data[el]
print(data)
As the latest interpolation was 'floor' the result of print(data):
Series object Untitled
0.782296: 2012-11-19 12:40:10
0.795469: 2012-11-19 12:40:10
0.821426: 2012-11-19 12:35:10
0.834957: 2012-11-19 12:35:10
0.864383: 2012-11-19 12:30:10
0.90624: 2012-11-19 12:25:10