{"id":38668246,"url":"https://github.com/risboo6909/fast-statistics","last_synced_at":"2026-01-17T09:52:12.088Z","repository":{"id":57428711,"uuid":"127664397","full_name":"risboo6909/fast-statistics","owner":"risboo6909","description":"Fast stats functions for Python written in Rust","archived":false,"fork":false,"pushed_at":"2018-11-02T16:17:01.000Z","size":105,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-22T14:56:12.100Z","etag":null,"topics":["pyo3","python","rust","rust-cpython","statistics"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/risboo6909.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-01T19:26:20.000Z","updated_at":"2023-01-28T15:28:13.000Z","dependencies_parsed_at":"2022-09-02T16:39:17.435Z","dependency_job_id":null,"html_url":"https://github.com/risboo6909/fast-statistics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/risboo6909/fast-statistics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risboo6909%2Ffast-statistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risboo6909%2Ffast-statistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risboo6909%2Ffast-statistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risboo6909%2Ffast-statistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/risboo6909","download_url":"https://codeload.github.com/risboo6909/fast-statistics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/risboo6909%2Ffast-statistics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28505565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"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":["pyo3","python","rust","rust-cpython","statistics"],"created_at":"2026-01-17T09:52:09.549Z","updated_at":"2026-01-17T09:52:12.062Z","avatar_url":"https://github.com/risboo6909.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fast-statistics\n\n[![Build Status](https://travis-ci.com/risboo6909/fast-statistics.svg?token=sEoRH24ki1j8CFisEvo5\u0026branch=master)](https://travis-ci.com/risboo6909/fast-statistics)\n\n# Fast-statistics\n\nFast-statistics is a small package of various statistical methods for Python 3 (yet!, Python 2.7 is comming) implemented in Rust. The idea was taken from Python 3 statistics package (see https://docs.python.org/3/library/statistics.html). This package is written on pure python and may work too slow on big data sets. Fast-statistics implements same stat functions as the original library does but it also works faster in most cases.\n\n#### When to use this library?\n\nShort answer -  whenever you want to compute something with the better performance than default python implementation may provide.\n\nQuick example.\n\nLet's suppose we want to find a median of a given list of floating point numbers, we could simply write:\n```python\nfrom fast_stat import median\n\nmedian_value = median([2.0, 1.0, 3.0, 5.0, 7.0])\nprint (median_value)\n```\n\ncompared to pure python version:\n\n```python\nfrom statistics import median\n\nmedian_value = median([2.0, 1.0, 3.0, 5.0, 7.0])\nprint (median_value)\n```\n\nIt looks as simple as a pure python version and although it can't be seen from this contrived example, works almost 10 times faster.\n\n#### Limitations\n\nEverythings has its price.\n\nMajor difference between python and rust implementation is that the latter one uses strict typing inside. This is actually a good thing, but at the same time it imposes some restrictions one should aware of.\n\n1. Some functions work with real numbers only by default. Fast-statistics uses \n```f64```\n inside to represent real numbers. If you pass a list of integers to such a function, all its contents will be automatically converted into reals, so be careful using it because python doesn't introduce any limits to integers so conversion of very big numbers to \n```f64```\n may cause incorrect results. See the list of supported functions and their input and output type below.\n\n2. Original python statistics package is able to work with arbitrary big integers, decimals and ratios. If you need one of those types then fast-statistics won't help you with that. It only works with native types such as 64 bit integers and floating point numbers.\n\n3. There is a routine in python statistics package which is intended to improve accuracy of \nsum\n function by converting floating point numbers into fractions and then summing them up. \nsum\n is implicitly used in many various stat calculations. I didn't implement such a behaviour in the first version of fast-statistics, however this issue seems to matter in rare cases  when summing up very small and very large numbers at the same time. I think this feature will be implemented in further versions of the library.\n\n#### Benchmarks\n\nPerformance (fast_stat) vs python version (statistics)\n\nIntel(R) Core(TM) i7-4600U CPU @ 2.10GHz\n```\nData set size is 1000000 elements\n\nMode computation benchmarks\n\nfast_stat.mode_int 10 loops, best of 3: 151 msec per loop\nfast_stat.mode_uint 10 loops, best of 3: 161 msec per loop\nstatistics.mode 10 loops, best of 3: 134 msec per loop\n\nfast_stat.mode_float 10 loops, best of 3: 181 msec per loop\nstatistics.mode 10 loops, best of 3: 181 msec per loop\n\n\nMedian search on heterogeneous data\n\nfast_stat.median 10 loops, best of 3: 49.7 msec per loop\nstatistics.median 10 loops, best of 3: 636 msec per loop\nfast_stat.median_low 10 loops, best of 3: 59.8 msec per loop\nstatistics.median_low 10 loops, best of 3: 639 msec per loop\n\nfast_stat.median_grouped, interval 2 10 loops, best of 3: 176 msec per loop\nstatistics.median_grouped, interval 2 10 loops, best of 3: 641 msec per loop\nfast_stat.median_grouped, interval 20 10 loops, best of 3: 175 msec per loop\nstatistics.median_grouped, interval 20 10 loops, best of 3: 643 msec per loop\n\nMedian search on homogeneous data\n\nfast_stat.median 10 loops, best of 3: 58.6 msec per loop\nstatistics.median 10 loops, best of 3: 137 msec per loop\nfast_stat.median_high 10 loops, best of 3: 70.7 msec per loop\nstatistics.median_high 10 loops, best of 3: 132 msec per loop\n\nfast_stat.median_grouped, interval 2 10 loops, best of 3: 119 msec per loop\nstatistics.median_grouped, interval 2 10 loops, best of 3: 139 msec per loop\nfast_stat.median_grouped, interval 20 10 loops, best of 3: 118 msec per loop\nstatistics.median_grouped, interval 20 10 loops, best of 3: 155 msec per loop\n\n\nHarmonic mean computation on random data\n\nfast_stat.harmonic_mean 10 loops, best of 3: 40.3 msec per loop\nstatistics.harmonic_mean 10 loops, best of 3: 1.18 sec per loop\n\n\nStandard deviation on random data\n\nfast_stat.stdev 10 loops, best of 3: 38.9 msec per loop\nstatistics.stdev 10 loops, best of 3: 3.3 sec per loop\n```\n\n#### Supported functions\n```\nvariance :: [f64] -\u003e f64\npvariance :: [f64] -\u003e f64\npstdev :: [f64] -\u003e f64\nstdev :: [f64] -\u003e f64\nmean :: [f64] -\u003e f64\nharmonic_mean :: [f64] -\u003e f64\nmedian :: [f64] -\u003e f64\nmedian_low :: [f64] -\u003e f64\nmedian_high :: [f64] -\u003e f64\nmedian_grouped :: [usize] -\u003e f64\nmode_float :: [f64] -\u003e f64\nmode_int :: [i64] -\u003e i64\nmode_uint :: [u64] -\u003e u64\nmode_str :: [str] -\u003e str\nkth_stat_float :: [usize] -\u003e f64\nkth_stat_uint :: [usize] -\u003e uint\nkth_stat_int :: [usize] -\u003e int\n```\n\n#### Pull-requests are welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frisboo6909%2Ffast-statistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frisboo6909%2Ffast-statistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frisboo6909%2Ffast-statistics/lists"}