I have data in two numpy arrays:
data = [0.1, 0.3, 0.4, 0.6, 0.7]
time = [10,25, 27, 35, 42]
data corresponds to a value at the equivalent index of time
I want to create another array based a new time array that looks like this:
newtime = [10, 20, 30, 40, 50]
The new data array should look like this:
[0.1, 0.1, 0.4,0.6, 0.7]
Which corresponds to the value of data at each of the new times. For example, at 10s, the value was 0.1, and at 20 seconds the value had not changed, so both should be 0.1
The question is what's the easiest possible way to create the "new data" numpy from the data array and time array in python? I would be happy to try other python libraries as well other than numpy.