You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
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)
The text was updated successfully, but these errors were encountered: