{"id":13718928,"url":"https://github.com/mrkn/enumerable-statistics","last_synced_at":"2025-04-08T06:36:02.197Z","repository":{"id":49417005,"uuid":"57318500","full_name":"mrkn/enumerable-statistics","owner":"mrkn","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-26T08:38:04.000Z","size":570,"stargazers_count":122,"open_issues_count":9,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-01T04:52:59.206Z","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/mrkn.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}},"created_at":"2016-04-28T16:42:22.000Z","updated_at":"2025-03-09T06:06:51.000Z","dependencies_parsed_at":"2024-06-18T18:39:01.068Z","dependency_job_id":"36cc8de3-483c-4abd-8a1b-475339d218f2","html_url":"https://github.com/mrkn/enumerable-statistics","commit_stats":{"total_commits":160,"total_committers":3,"mean_commits":"53.333333333333336","dds":0.03749999999999998,"last_synced_commit":"44d68761ac17554dc3a8aaadc534afb8393e2156"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkn%2Fenumerable-statistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkn%2Fenumerable-statistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkn%2Fenumerable-statistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrkn%2Fenumerable-statistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrkn","download_url":"https://codeload.github.com/mrkn/enumerable-statistics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247792880,"owners_count":20996891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-08-03T01:00:39.596Z","updated_at":"2025-04-08T06:36:02.130Z","avatar_url":"https://github.com/mrkn.png","language":"Ruby","funding_links":[],"categories":["Statistics","Ruby"],"sub_categories":[],"readme":"# Enumerable::Statistics\n\n[![Build Status](https://travis-ci.org/mrkn/enumerable-statistics.svg?branch=master)](https://travis-ci.org/mrkn/enumerable-statistics)\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/mrkn/enumerable-statistics.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkn%2Fenumerable-statistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrkn%2Fenumerable-statistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrkn%2Fenumerable-statistics/lists"}