Open theHausdorffMetric opened 2 years ago
We should probably return NaN instead of panicking or returning a wrong result.
I think this might happen with all order statistics (at least lower_quartile and upper_quartile in my usage).
numpy
has functions np.nan[statistic]
, one to ignore NaN and the other to emit NaN.
We can follow that and do similar for quartiles and will emit Option::None
instead of NaN when data is empty.
Making the change breaks API (but makes it match the docs), so the other option would be to implement a StatisticsNan
that emits Option
<_ as statistics::Median>::median -> Option<T>
Think I'll make it Option. Also considering the value of associated type since it's a returned value.
Two examples of f64 Data with NaN. Depending on position of NaN, median either panics or delivers a wrong result.