{"id":18016891,"url":"https://github.com/fitzgen/histo","last_synced_at":"2025-03-26T18:32:32.661Z","repository":{"id":52242298,"uuid":"99657662","full_name":"fitzgen/histo","owner":"fitzgen","description":"Histograms with a configurable number of buckets, and a terminal-friendly Display.","archived":false,"fork":false,"pushed_at":"2024-04-12T15:44:18.000Z","size":20,"stargazers_count":31,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-17T11:59:42.127Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.rs/histo","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fitzgen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2017-08-08T06:23:11.000Z","updated_at":"2024-12-06T15:27:35.000Z","dependencies_parsed_at":"2024-10-30T04:43:52.410Z","dependency_job_id":null,"html_url":"https://github.com/fitzgen/histo","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"ae1d2fc733b07a24dbd6fd3b03ff2a782a9c7efc"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fhisto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fhisto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fhisto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitzgen%2Fhisto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fitzgen","download_url":"https://codeload.github.com/fitzgen/histo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245713147,"owners_count":20660353,"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":[],"created_at":"2024-10-30T04:19:37.441Z","updated_at":"2025-03-26T18:32:32.316Z","avatar_url":"https://github.com/fitzgen.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `histo`\n\n[![Rust](https://github.com/fitzgen/histo/actions/workflows/rust.yml/badge.svg)](https://github.com/fitzgen/histo/actions/workflows/rust.yml) [![histo on crates.io](https://img.shields.io/crates/v/histo.svg)](https://crates.io/crates/histo) [![histo on docs.rs](https://docs.rs/histo/badge.svg)](https://docs.rs/histo/)\n\nHistograms with a configurable number of buckets, and a terminal-friendly\n`Display`.\n\nThis crate provides a `Histogram` type that allows configuration of the number\nof buckets that will be used, regardless of the range of input samples. This is\nuseful when displaying a `Histogram` (for example, when printing it to a\nterminal) but it sacrifices fancy tracking of precision and significant figures.\n\nIt uses O(n) memory.\n\n```rust\nextern crate histo;\nuse histo::Histogram;\n\n// Create a histogram that will have 10 buckets.\nlet mut histogram = Histogram::with_buckets(10);\n\n// Adds some samples to the histogram.\nfor sample in 0..100 {\n    histogram.add(sample);\n    histogram.add(sample * sample);\n}\n\n// Iterate over buckets and do stuff with their range and count.\nfor bucket in histogram.buckets() {\n    do_stuff(bucket.start(), bucket.end(), bucket.count());\n}\n\n// And you can also `Display` a histogram!\nprintln!(\"{}\", histogram);\n\n// Prints:\n//\n// ```\n// # Number of samples = 200\n// # Min = 0\n// # Max = 9801\n// #\n// # Mean = 1666.5000000000005\n// # Standard deviation = 2641.2281518263426\n// # Variance = 6976086.1499999985\n// #\n// # Each ∎ is a count of 2\n// #\n//    0 ..  980 [ 132 ]: ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎\n//  980 .. 1960 [  13 ]: ∎∎∎∎∎∎\n// 1960 .. 2940 [  10 ]: ∎∎∎∎∎\n// 2940 .. 3920 [   8 ]: ∎∎∎∎\n// 3920 .. 4900 [   7 ]: ∎∎∎\n// 4900 .. 5880 [   7 ]: ∎∎∎\n// 5880 .. 6860 [   6 ]: ∎∎∎\n// 6860 .. 7840 [   6 ]: ∎∎∎\n// 7840 .. 8820 [   5 ]: ∎∎\n// 8820 .. 9800 [   6 ]: ∎∎∎\n// ```\n```\n\n## Install and Usage\n\nTo use the `histo` crate in your Rust project, add it to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nhisto = \"0.1.0\"\n```\n\nThe `histo` crate also comes with the command line `histo` tool:\n\n```commands\n$ cargo install histo\n$ tail samples.txt\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n$ histo \u003c samples.txt\n# Number of samples = 150\n# Min = 1\n# Max = 10\n#\n# Mean = 5.833333333333334\n# Standard deviation = 1.9301698255737905\n# Variance = 3.7255555555555566\n#\n# Each ∎ is a count of 1\n#\n 1 ..  2 [  3 ]: ∎∎∎\n 2 ..  3 [  3 ]: ∎∎∎\n 3 ..  4 [  3 ]: ∎∎∎\n 4 ..  5 [ 31 ]: ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎\n 5 ..  6 [ 28 ]: ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎\n 6 ..  7 [ 29 ]: ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎\n 7 ..  8 [ 29 ]: ∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎∎\n 8 ..  9 [  8 ]: ∎∎∎∎∎∎∎∎\n 9 .. 10 [  8 ]: ∎∎∎∎∎∎∎∎\n10 .. 11 [  8 ]: ∎∎∎∎∎∎∎∎\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitzgen%2Fhisto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffitzgen%2Fhisto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitzgen%2Fhisto/lists"}