{"id":28047875,"url":"https://github.com/red-data-tools/enumerable-statistics","last_synced_at":"2026-03-04T16:31:22.467Z","repository":{"id":49417005,"uuid":"57318500","full_name":"red-data-tools/enumerable-statistics","owner":"red-data-tools","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-18T13:02:59.000Z","size":595,"stargazers_count":131,"open_issues_count":8,"forks_count":9,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-02-22T22:53:52.514Z","etag":null,"topics":["rubydatascience"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/red-data-tools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-04-28T16:42:22.000Z","updated_at":"2026-01-18T13:03:03.000Z","dependencies_parsed_at":"2024-06-18T18:39:01.068Z","dependency_job_id":"36cc8de3-483c-4abd-8a1b-475339d218f2","html_url":"https://github.com/red-data-tools/enumerable-statistics","commit_stats":{"total_commits":160,"total_committers":3,"mean_commits":"53.333333333333336","dds":0.03749999999999998,"last_synced_commit":"44d68761ac17554dc3a8aaadc534afb8393e2156"},"previous_names":["red-data-tools/enumerable-statistics"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/red-data-tools/enumerable-statistics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fenumerable-statistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fenumerable-statistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fenumerable-statistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fenumerable-statistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/red-data-tools","download_url":"https://codeload.github.com/red-data-tools/enumerable-statistics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fenumerable-statistics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30086451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rubydatascience"],"created_at":"2025-05-11T21:05:27.190Z","updated_at":"2026-03-04T16:31:22.431Z","avatar_url":"https://github.com/red-data-tools.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Enumerable::Statistics\n\n[![Build Status](https://github.com/red-data-tools/enumerable-statistics/actions/workflows/ci.yml/badge.svg)](https://github.com/red-data-tools/enumerable-statistics/actions/workflows/ci.yml)\n\nEnumerable::Statistics provides some methods to calculate statistical summary in arrays and enumerables.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'enumerable-statistics'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install enumerable-statistics\n\n## Usage\n\nYou should load this library by the following line in your script at first.\n\n```ruby\nrequire 'enumerable/statistics'\n```\n\nThe following methods are supplied by this library:\n\n- `Array#mean`, `Enumerable#mean`\n  - Calculates a mean of values in an array or an enumerable\n- `Array#variance`, `Enumerable#variance`\n  - Calculates a variance of values in an array or an enumerable\n- `Array#stdev`, `Enumerable#stdev`\n  - Calculates a standard deviation of values in an array or an enumerable\n- `Array#mean_variance`, `Enumerable#mean_variance`\n  - Calculates a mean and a variance simultaneously\n- `Array#mean_stdev`, `Enumerable#mean_stdev`\n  - Calculates a mean and a standard deviation simultaneously\n- `Array#median`\n  - Calculates a median of values in an array\n- `Array#percentile(q)`\n  - Calculates a percentile or percentiles of values in an array\n- `Array#value_counts`, `Enumerable#value_counts`, and `Hash#value_counts`\n  - Count how many items for each value in the container\n- `Array#histogram`\n  - Calculate histogram of the values in the array\n\nMoreover, for Ruby \u003c 2.4, `Array#sum` and `Enumerable#sum` are provided.\n\nAll methods scan a collection once to calculate statistics and preserve precision as possible.\n\n## Performance\n\n```\n$ bundle exec rake bench\n# sum\nWarming up --------------------------------------\n              inject     1.545k i/100ms\n               while     2.342k i/100ms\n                 sum    11.009k i/100ms\nCalculating -------------------------------------\n              inject     15.016k (± 9.6%) i/s -     75.705k in   5.098723s\n               while     22.238k (±16.2%) i/s -    107.732k in   5.068156s\n                 sum    112.992k (± 6.9%) i/s -    572.468k in   5.091868s\n# mean\nWarming up --------------------------------------\n              inject     1.578k i/100ms\n               while     2.057k i/100ms\n                mean     9.855k i/100ms\nCalculating -------------------------------------\n              inject     15.347k (± 8.6%) i/s -     77.322k in   5.076009s\n               while     21.669k (±14.5%) i/s -    106.964k in   5.074312s\n                mean    108.861k (± 8.9%) i/s -    542.025k in   5.021786s\n# variance\nWarming up --------------------------------------\n              inject   586.000  i/100ms\n               while   826.000  i/100ms\n            variance     8.475k i/100ms\nCalculating -------------------------------------\n              inject      6.187k (± 6.7%) i/s -     31.058k in   5.043418s\n               while      8.597k (± 7.4%) i/s -     42.952k in   5.024587s\n            variance     84.702k (± 8.5%) i/s -    423.750k in   5.039936s\n```\n\n![](./images/benchmark.png)\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/red-data-tools/enumerable-statistics.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fred-data-tools%2Fenumerable-statistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fred-data-tools%2Fenumerable-statistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fred-data-tools%2Fenumerable-statistics/lists"}