Often I have holes in my data, and I want to get some stats but ignore nulls.
example:
data = [1, 2, 3, 4, 5, nil] # => [1, 2, 3, 4, 5, nil]
stats = DescriptiveStatistics::Stats.new(data)
stats.mean # => 2.5
because the nil is treated like a zero. If instead this "data hole" is ignored, the mean should be 3.0, as in
stats = DescriptiveStatistics::Stats.new(data.compact)
stats.mean # => 3.0
Has there been any discussion of an optional parameter to ignore nulls? Perhaps something like:
stats = DescriptiveStatistics::State.new(data, ignore_nulls=true)
Often I have holes in my data, and I want to get some stats but ignore nulls.
example:
data = [1, 2, 3, 4, 5, nil] # => [1, 2, 3, 4, 5, nil]stats = DescriptiveStatistics::Stats.new(data)stats.mean # => 2.5because the nil is treated like a zero. If instead this "data hole" is ignored, the mean should be 3.0, as in
stats = DescriptiveStatistics::Stats.new(data.compact)stats.mean # => 3.0Has there been any discussion of an optional parameter to ignore nulls? Perhaps something like:
stats = DescriptiveStatistics::State.new(data, ignore_nulls=true)