{"id":13393593,"url":"https://github.com/montanaflynn/stats","last_synced_at":"2026-03-11T23:15:57.459Z","repository":{"id":24658340,"uuid":"28068530","full_name":"montanaflynn/stats","owner":"montanaflynn","description":"A well tested and comprehensive Golang statistics library package with no dependencies.","archived":false,"fork":false,"pushed_at":"2026-01-02T17:28:59.000Z","size":298,"stargazers_count":2997,"open_issues_count":16,"forks_count":172,"subscribers_count":51,"default_branch":"master","last_synced_at":"2026-01-09T03:53:13.857Z","etag":null,"topics":["algorithms","analytics","data","go","machine-learning","math","rounding","statistics","stats"],"latest_commit_sha":null,"homepage":"","language":"Go","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/montanaflynn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["montanaflynn"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2014-12-16T03:25:19.000Z","updated_at":"2026-01-05T17:33:05.000Z","dependencies_parsed_at":"2023-01-14T01:23:02.952Z","dependency_job_id":"a37e361d-56c4-451a-ae6d-ab0fb2f5fb18","html_url":"https://github.com/montanaflynn/stats","commit_stats":{"total_commits":241,"total_committers":30,"mean_commits":8.033333333333333,"dds":"0.48547717842323657","last_synced_commit":"f033e64d373b966ee3118a2a070fa658c45a78e4"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/montanaflynn/stats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/montanaflynn","download_url":"https://codeload.github.com/montanaflynn/stats/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/montanaflynn%2Fstats/sbom","scorecard":{"id":659063,"data":{"date":"2025-08-11","repo":{"name":"github.com/montanaflynn/stats","commit":"48c484bcc27e9964b666b10fdf711ea5c5c31a77"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":2,"reason":"Found 6/29 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/montanaflynn/stats/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/montanaflynn/stats/go.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/montanaflynn/stats/go.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T15:32:44.905Z","repository_id":24658340,"created_at":"2025-08-21T15:32:44.905Z","updated_at":"2025-08-21T15:32:44.905Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30406516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T22:36:59.286Z","status":"ssl_error","status_checked_at":"2026-03-11T22:36:57.544Z","response_time":84,"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":["algorithms","analytics","data","go","machine-learning","math","rounding","statistics","stats"],"created_at":"2024-07-30T17:00:56.584Z","updated_at":"2026-03-11T23:15:57.453Z","avatar_url":"https://github.com/montanaflynn.png","language":"Go","funding_links":["https://github.com/sponsors/montanaflynn"],"categories":["Science and Data Analysis","Go","开源类库","Open source library","数据分析与数据科学","科學及數據分析","科学与数据分析","Relational Databases","科学及数据分析","\u003cspan id=\"科学和数据分析-science-and-data-analysis\"\u003e科学和数据分析 Science and Data Analysis\u003c/span\u003e","Repositories","Golang","科学和数据分析"],"sub_categories":["HTTP Clients","开发辅助包","Development Aid Package","查询语","高級控制台界面","HTTP客户端","Advanced Console UIs","交流","高级控制台界面","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","Statistics"],"readme":"# Stats - Golang Statistics Package\n\n[![][action-svg]][action-url] [![][codecov-svg]][codecov-url] [![][goreport-svg]][goreport-url] [![][godoc-svg]][godoc-url] [![][pkggodev-svg]][pkggodev-url] [![][license-svg]][license-url]\n\nA well tested and comprehensive Golang statistics library / package / module with no dependencies.\n\nIf you have any suggestions, problems or bug reports please [create an issue](https://github.com/montanaflynn/stats/issues) and I'll do my best to accommodate you. In addition simply starring the repo would show your support for the project and be very much appreciated!\n\n## Installation\n\n```\ngo get github.com/montanaflynn/stats\n```\n\n## Example Usage\n\nAll the functions can be seen in [examples/main.go](examples/main.go) but here's a little taste:\n\n```go\n// start with some source data to use\ndata := []float64{1.0, 2.1, 3.2, 4.823, 4.1, 5.8}\n\n// you could also use different types like this\n// data := stats.LoadRawData([]int{1, 2, 3, 4, 5})\n// data := stats.LoadRawData([]interface{}{1.1, \"2\", 3})\n// etc...\n\nmedian, _ := stats.Median(data)\nfmt.Println(median) // 3.65\n\nroundedMedian, _ := stats.Round(median, 0)\nfmt.Println(roundedMedian) // 4\n```\n\n## Documentation\n\nThe entire API documentation is available on [GoDoc.org](http://godoc.org/github.com/montanaflynn/stats) or [pkg.go.dev](https://pkg.go.dev/github.com/montanaflynn/stats).\n\nYou can also view docs offline with the following commands:\n\n```\n# Command line\ngodoc .              # show all exported apis\ngodoc . Median       # show a single function\ngodoc -ex . Round    # show function with example\ngodoc . Float64Data  # show the type and methods\n\n# Local website\ngodoc -http=:4444    # start the godoc server on port 4444\nopen http://localhost:4444/pkg/github.com/montanaflynn/stats/\n```\n\nThe exported API is as follows:\n\n```go\nvar (\n    ErrEmptyInput = statsError{\"Input must not be empty.\"}\n    ErrNaN        = statsError{\"Not a number.\"}\n    ErrNegative   = statsError{\"Must not contain negative values.\"}\n    ErrZero       = statsError{\"Must not contain zero values.\"}\n    ErrBounds     = statsError{\"Input is outside of range.\"}\n    ErrSize       = statsError{\"Must be the same length.\"}\n    ErrInfValue   = statsError{\"Value is infinite.\"}\n    ErrYCoord     = statsError{\"Y Value must be greater than zero.\"}\n)\n\nfunc Round(input float64, places int) (rounded float64, err error) {}\n\ntype Float64Data []float64\n\nfunc LoadRawData(raw interface{}) (f Float64Data) {}\n\nfunc AutoCorrelation(data Float64Data, lags int) (float64, error) {}\nfunc ChebyshevDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {}\nfunc Correlation(data1, data2 Float64Data) (float64, error) {}\nfunc Covariance(data1, data2 Float64Data) (float64, error) {}\nfunc CovariancePopulation(data1, data2 Float64Data) (float64, error) {}\nfunc CumulativeSum(input Float64Data) ([]float64, error) {}\nfunc Describe(input Float64Data, allowNaN bool, percentiles *[]float64) (*Description, error) {}\nfunc DescribePercentileFunc(input Float64Data, allowNaN bool, percentiles *[]float64, percentileFunc func(Float64Data, float64) (float64, error)) (*Description, error) {}\nfunc Entropy(input Float64Data) (float64, error) {}\nfunc EuclideanDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {}\nfunc GeometricMean(input Float64Data) (float64, error) {}\nfunc HarmonicMean(input Float64Data) (float64, error) {}\nfunc InterQuartileRange(input Float64Data) (float64, error) {}\nfunc ManhattanDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {}\nfunc Max(input Float64Data) (max float64, err error) {}\nfunc Mean(input Float64Data) (float64, error) {}\nfunc Median(input Float64Data) (median float64, err error) {}\nfunc MedianAbsoluteDeviation(input Float64Data) (mad float64, err error) {}\nfunc MedianAbsoluteDeviationPopulation(input Float64Data) (mad float64, err error) {}\nfunc Midhinge(input Float64Data) (float64, error) {}\nfunc Min(input Float64Data) (min float64, err error) {}\nfunc MinkowskiDistance(dataPointX, dataPointY Float64Data, lambda float64) (distance float64, err error) {}\nfunc Mode(input Float64Data) (mode []float64, err error) {}\nfunc NormBoxMullerRvs(loc float64, scale float64, size int) []float64 {}\nfunc NormCdf(x float64, loc float64, scale float64) float64 {}\nfunc NormEntropy(loc float64, scale float64) float64 {}\nfunc NormFit(data []float64) [2]float64{}\nfunc NormInterval(alpha float64, loc float64,  scale float64 ) [2]float64 {}\nfunc NormIsf(p float64, loc float64, scale float64) (x float64) {}\nfunc NormLogCdf(x float64, loc float64, scale float64) float64 {}\nfunc NormLogPdf(x float64, loc float64, scale float64) float64 {}\nfunc NormLogSf(x float64, loc float64, scale float64) float64 {}\nfunc NormMean(loc float64, scale float64) float64 {}\nfunc NormMedian(loc float64, scale float64) float64 {}\nfunc NormMoment(n int, loc float64, scale float64) float64 {}\nfunc NormPdf(x float64, loc float64, scale float64) float64 {}\nfunc NormPpf(p float64, loc float64, scale float64) (x float64) {}\nfunc NormPpfRvs(loc float64, scale float64, size int) []float64 {}\nfunc NormSf(x float64, loc float64, scale float64) float64 {}\nfunc NormStats(loc float64, scale float64, moments string) []float64 {}\nfunc NormStd(loc float64, scale float64) float64 {}\nfunc NormVar(loc float64, scale float64) float64 {}\nfunc Pearson(data1, data2 Float64Data) (float64, error) {}\nfunc Percentile(input Float64Data, percent float64) (percentile float64, err error) {}\nfunc PercentileNearestRank(input Float64Data, percent float64) (percentile float64, err error) {}\nfunc PopulationVariance(input Float64Data) (pvar float64, err error) {}\nfunc Sample(input Float64Data, takenum int, replacement bool) ([]float64, error) {}\nfunc SampleVariance(input Float64Data) (svar float64, err error) {}\nfunc Sigmoid(input Float64Data) ([]float64, error) {}\nfunc SoftMax(input Float64Data) ([]float64, error) {}\nfunc StableSample(input Float64Data, takenum int) ([]float64, error) {}\nfunc StandardDeviation(input Float64Data) (sdev float64, err error) {}\nfunc StandardDeviationPopulation(input Float64Data) (sdev float64, err error) {}\nfunc StandardDeviationSample(input Float64Data) (sdev float64, err error) {}\nfunc StdDevP(input Float64Data) (sdev float64, err error) {}\nfunc StdDevS(input Float64Data) (sdev float64, err error) {}\nfunc Sum(input Float64Data) (sum float64, err error) {}\nfunc Trimean(input Float64Data) (float64, error) {}\nfunc VarP(input Float64Data) (sdev float64, err error) {}\nfunc VarS(input Float64Data) (sdev float64, err error) {}\nfunc Variance(input Float64Data) (sdev float64, err error) {}\nfunc ProbGeom(a int, b int, p float64) (prob float64, err error) {}\nfunc ExpGeom(p float64) (exp float64, err error) {}\nfunc VarGeom(p float64) (exp float64, err error) {}\n\ntype Coordinate struct {\n    X, Y float64\n}\n\ntype Series []Coordinate\n\nfunc ExponentialRegression(s Series) (regressions Series, err error) {}\nfunc LinearRegression(s Series) (regressions Series, err error) {}\nfunc LogarithmicRegression(s Series) (regressions Series, err error) {}\n\ntype Outliers struct {\n    Mild    Float64Data\n    Extreme Float64Data\n}\n\ntype Quartiles struct {\n    Q1 float64\n    Q2 float64\n    Q3 float64\n}\n\nfunc Quartile(input Float64Data) (Quartiles, error) {}\nfunc QuartileOutliers(input Float64Data) (Outliers, error) {}\n```\n\n## Contributing\n\nPull request are always welcome no matter how big or small. I've included a [Makefile](https://github.com/montanaflynn/stats/blob/master/Makefile) that has a lot of helper targets for common actions such as linting, testing, code coverage reporting and more.\n\n1. Fork the repo and clone your fork\n2. Create new branch (`git checkout -b some-thing`)\n3. Make the desired changes\n4. Ensure tests pass (`go test -cover` or `make test`)\n5. Run lint and fix problems (`go vet .` or `make lint`)\n6. Commit changes (`git commit -am 'Did something'`)\n7. Push branch (`git push origin some-thing`)\n8. Submit pull request\n\nTo make things as seamless as possible please also consider the following steps:\n\n- Update `examples/main.go` with a simple example of the new feature\n- Update `README.md` documentation section with any new exported API\n- Keep 100% code coverage (you can check with `make coverage`)\n- Squash commits into single units of work with `git rebase -i new-feature`\n\n## Releasing\n\nReleases are automated with [GoReleaser](https://goreleaser.com/) via GitHub Actions. To create a new release, push a version tag:\n\n```\ngit tag v0.x.x\ngit push origin v0.x.x\n```\n\n## MIT License\n\nCopyright (c) 2014-2026 Montana Flynn (https://montanaflynn.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORpublicS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[action-url]: https://github.com/montanaflynn/stats/actions\n[action-svg]: https://img.shields.io/github/actions/workflow/status/montanaflynn/stats/go.yml\n\n[codecov-url]: https://app.codecov.io/gh/montanaflynn/stats\n[codecov-svg]: https://img.shields.io/codecov/c/github/montanaflynn/stats?token=wnw8dActnH\n\n[goreport-url]: https://goreportcard.com/report/github.com/montanaflynn/stats\n[goreport-svg]: https://goreportcard.com/badge/github.com/montanaflynn/stats\n\n[godoc-url]: https://godoc.org/github.com/montanaflynn/stats\n[godoc-svg]: https://godoc.org/github.com/montanaflynn/stats?status.svg\n\n[pkggodev-url]: https://pkg.go.dev/github.com/montanaflynn/stats\n[pkggodev-svg]: https://gistcdn.githack.com/montanaflynn/b02f1d78d8c0de8435895d7e7cd0d473/raw/17f2a5a69f1323ecd42c00e0683655da96d9ecc8/badge.svg\n\n[license-url]: https://github.com/montanaflynn/stats/blob/master/LICENSE\n[license-svg]: https://img.shields.io/badge/license-MIT-blue.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontanaflynn%2Fstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmontanaflynn%2Fstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmontanaflynn%2Fstats/lists"}