I have 2 np.arrays:
The first one called data:
data= array([ 17. , nan, 8.1, 25.1, nan, 6.9, nan, 27.1, 46.6,
34.1, 25.7, nan, ... , 25.3 ])
Array of float 64 Size (366,)
To get the second one i did an interpolation. So i should first drop the NaN values:
data = data[~numpy.isnan(data)]
So i have now the data like this:
data = array([ 17. , 8.1, 25.1, 6.9, 27.1, 46.6,
34.1, 25.7, ... , 25.3 ])
Array of float 64 Size (283,)
And after the interpolation i get the second one:
interpolated_data = array([ 16 , 7.1, 24.1, 7.9, 26.1, 45.6,
33.1, 27.7, ... , 24.3 ])
Array of float 64 Size (283,)
Now i want to give it back the nan values in the same index position in both arrays.
Expected values:
data = array([ 17. , nan, 8.1, 25.1, nan, 6.9, nan, 27.1, 46.6,
34.1, 25.7, nan, ... , 25.3 ])
Array of float 64 Size (366,)
interpolated_data = array([ 16 , nan, 7.1, 24.1, nan, 7.9, nan, 26.1, 45.6,
33.1, 27.7, nan, ... , 24.3 ])
Array of float 64 Size (366,)
Would you mind to help me? Thanks in advance.
data = data[~numpy.isnan(data)]and instead usedata[~numpy.isnan(data)] = interpolation(data[~numpy.isnan(data)])