How to filter or drop a value based on the previous one using Deedle in C#? -
i dealing data sensors. these sensors have blackouts , brownouts, in consequence can have following kind of time series in frame, let's call "mydata":
[7.438984; 0,000002; 7.512345; 0.000000; 7.634912; 0.005123; 7.845627...]
because need 3 decimals precision, rounded data frame:
var myroundeddata = mydata.columnapply((series<datetime, double> numbers) => numbers.select(kvp => math.round(kvp.value, 3))); i columns frame , filtered zeros "0.000":
var myfilteredtimeseries = kvp in mytimeseries kvp.value != 0.000 select kvp; so, time series partially filtered: [7.439; 7.512; 7.635; 0.006; 7.846...]
however, value "0.006" not valid!
how implement elegant filtering syntax based on previous value, "percent limit" in rate of change:
if (0.006 / 7.635) * 100 < 0.1 ---> drop / delete(0.006)
if want @ previous/next value, can shift series 1 , zip original. give series of pairs (a value previous/next value):
var r = actual.zipinner(actual.shift(1)); if want @ more elements around specified one, you'll need 1 of windowing functions provided deedle:
the simplest example use windowinto value 4 values before it:
var res = values.windowinto(5, win => // 'win' series values - clever here! );
Comments
Post a Comment