Home Ask Login Register

Developers Planet

Your answer is one click away!

casbby February 2016

Deedle Series.LastValue and Series.tryLastValue both fail if the last value is missing

Despite the comments on the code both Series.LastValue and Series.tryLastValue fails if the last value is missing as both functions use the same getAt (series.KeyCount-1).

What is recommended way to get potential missing value from the series?

try Series.LastValue with? or Series.TryGet(key)?



Tomas Petricek February 2016

If the series is ordered, you can do the following:

let s = series [1 => 1.0; 2 => nan]
s.Get(s.LastKey(), Lookup.ExactOrSmaller)

Here, we want to look for a value for the last key, or the first non-missing value before that.

Post Status

Asked in February 2016
Viewed 3,875 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life