fslaborg / Deedle

Easy to use .NET library for data and time series manipulation and for scientific programming
http://fslab.org/Deedle/
BSD 2-Clause "Simplified" License
929 stars 196 forks source link

Missing values and NaN #335

Closed adamklein closed 8 years ago

adamklein commented 8 years ago

This looks like a bug:

var sb = new SeriesBuilder<string,OptionalValue<double>>();

sb.Add("a", OptionalValue.Create(1.0));
sb.Add("b", OptionalValue<double>.Missing);
sb.Add("c", OptionalValue.Create(2.0));

var s = sb.Series;
s.FillMissing(Direction.Forward).Format().Dump();

The missing value isn't filled-forward.

adamklein commented 8 years ago

This gets a little worse:

var s = new SeriesBuilder<string,OptionalValue<double>?>() {
    { "a", OptionalValue<double>.Missing },
    { "b", null },
    { "c", OptionalValue.Create(2.0)  } }.Series;

s.FillMissing(Direction.Forward).Get("b").HasValue.Dump(); // true

This forward-fills the missing value. The nullable/nan/empty trifurcation is definitely a usability trap ...

adamklein commented 8 years ago

Going to close this because it's not actually a bug. More of a gotcha. Could be useful for a wiki section.