Message Boards Message Boards

NA handling in TimeSeries["Date"] ... “0. + NA” ?


I have an issue with the handling of TimeSeries, which is best described by the following MWE:

data = Import[""];
dates = Table[DateList[{StringTake[data[[k, 1]], 10], {"Day", "Month","Year"}}], {k, 2, Length[data]}];
tsdata = TimeSeries[data[[2 ;;, 2 ;;]], {dates}];
tsdata["August 26, 2008"]

The resulting output is:

{6.67345,6.55845,7.46281,7.32023,6.89391,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,1.82743,1.77073,1.65871,1.56591,1.52516,1.46369,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,1.47368,1.57085,1.65731,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,1.18979,1.02756,1.08294,1.12263,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA,0. +NA}

However, it should be:

tsdata["Values"][[7, ;;]]


I can't figure out what causes this behaviour. Any suggestion is much appreciated.

(I'm using Mathematica

For reference, I raised the same question on Mathematica Stackexchange.

POSTED BY: Fabian Wo
1 month ago

I'm sure you already solved the issue, but just in case... the raw data has 23 lines and also the length of the data after import However, you define dates for lines 2 to 23, leaving you with 22 dates. This fills wrong to me The definition of tsdata has syntax error (you probably looked at it If you want to neglect the NA parts I recommend that you read a good explanation on missing data



POSTED BY: Yehuda Ben-Shimol
1 month ago

Group Abstract Group Abstract