I have the following matrix:
737044 NaN NaN NaN737045 NaN NaN NaN737046 NaN NaN NaN737047 NaN NaN NaN737048 NaN NaN NaN737049 NaN NaN NaN737050 NaN NaN NaN737051 NaN NaN NaN737052 NaN NaN NaN737053 NaN NaN NaN
In which the first column represents the date (datenum) and the other columns need to be filled with data coming from other time series. Let's say I want to fill the second column of this matrix with the following data, merging the values according to the date:
737045 12.33737047 15.01737051 14.77737052 14.63737053 13.89
I'm aiming to obtain the following result:
737044 NaN NaN NaN737045 12.33 NaN NaN737046 NaN NaN NaN737047 15.01 NaN NaN737048 NaN NaN NaN737049 NaN NaN NaN737050 NaN NaN NaN737051 14.77 NaN NaN737052 14.63 NaN NaN737053 13.89 NaN NaN
What is the best way to achieve this? How to deal with missing (NaN) values if, for example, I want to perform a regression? Interpolation? Leaving them as they are?
Best Answer