{"id":13581521,"url":"https://github.com/backplane/avg","last_synced_at":"2026-01-21T09:08:49.450Z","repository":{"id":39892112,"uuid":"443323117","full_name":"backplane/avg","owner":"backplane","description":"writes a summary of numeric data","archived":false,"fork":false,"pushed_at":"2023-03-02T13:40:19.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-05T21:44:47.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/backplane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-12-31T10:49:27.000Z","updated_at":"2023-04-29T22:19:36.000Z","dependencies_parsed_at":"2024-01-16T20:53:41.730Z","dependency_job_id":null,"html_url":"https://github.com/backplane/avg","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backplane%2Favg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backplane%2Favg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backplane%2Favg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/backplane%2Favg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/backplane","download_url":"https://codeload.github.com/backplane/avg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247470357,"owners_count":20944146,"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-08-01T15:02:04.262Z","updated_at":"2026-01-21T09:08:49.399Z","avatar_url":"https://github.com/backplane.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# avg\n\nutility which reads lines from the standard input and writes a summary of the numeric data found therein\n\nIt was inspired by the pandas [\"DataFrame describe\"](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.describe.html) method.\n\n## Output\n\nThis is an example of the output generated when the input is the sequence of numbers from 1 to 10:\n\n```\n count: 10\n   sum: 55\n   min: 1\n   max: 10\n  mean: 5.5\nmedian: 5.5\nstddev: 2.872281\n   iqr: 4.5\n   25%: 3.25\n   50%: 5.5\n   75%: 7.75\n   95%: 9.55\n   99%: 9.91\n```\n\n## Usage\n\nThis text is displayed when the program is invoked with the `-h` or `--help` arguments:\n\n```\nusage: avg [-h|--help]\n\nThis utility reads lines from the standard input and writes a summary of the\nnumeric data found therein.\n  -findall\n    \tfind all numbers on each input line, rather than just the first\n  -template string\n    \tthe template to use when printing the summary (in golang text/template format)\n```\n\n## Output Format\n\nThe program uses the go [text/template package](https://golang.org/pkg/text/template/) to generate its output report. You can override the output format using the `-template` option. This is the default template used:\n\n```\n count: {{len .Numbers | printf \"%d\"}}\n   sum: {{Sum .Numbers | TrimZeros}}\n   min: {{TrimZeros .Min}}\n   max: {{TrimZeros .Max}}\n  mean: {{Mean .Numbers | TrimZeros}}\nmedian: {{Median .Numbers | TrimZeros}}\nstddev: {{StdDev .Numbers | TrimZeros}}\n   iqr: {{Iqr .Numbers | TrimZeros}}\n   25%: {{Percentile .Numbers 0.25 | TrimZeros}}\n   50%: {{Percentile .Numbers 0.5 | TrimZeros}}\n   75%: {{Percentile .Numbers 0.75 | TrimZeros}}\n   95%: {{Percentile .Numbers 0.95 | TrimZeros}}\n   99%: {{Percentile .Numbers 0.99 | TrimZeros}}\n```\n\nThe template is named `summary` and it has the following data items available:\n\n* `.Numbers` - a pre-sorted slice of numbers in float64 format\n* `.Min` - the value of the first item of the Numbers slice (smallest value)\n* `.Max` - the value of the final item of the Numbers slice (largest value)\n* `.Count` - the number of items in the Numbers slice in integer format\n\nAdditionally, the following functions are available to the template:\n\n* `Iqr` - inter-quartile range (absolute value of difference between 25th and 75th percentiles)\n* `Mean` - simple mean or \"average\" (sum of values divided by count of values)\n* `Median` - value of the middle item in a sorted slice if there are an odd number of elements OR the mean of the middle pair if the slice has an even number of elements\n* `Percentile` - the value of the member at the given percentage into the slice, includes fractional adjustment to final value (argument is a float64; the 25th precentile is available with the argument `0.25`)\n* `StdDev` - standard deviation (note: it assumes the slice represents the entire population, not a population sample)\n* `Sum` - the sum of all values in the slice\n* `TrimZeros` - starts with `%f` and trims trailing zeros and trailing decimal point. This is similar to `%g` but will **not** express extreme values in exponential notation.\n\nYou may use backslash-quoted special characters like `\\n` within the template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackplane%2Favg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbackplane%2Favg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbackplane%2Favg/lists"}