{
  "id": "python-statistics-table",
  "kind": "table",
  "slug": "python-statistics",
  "iil_id": null,
  "note_url": "https://iinventedlight.com/library/notes/python-statistics/",
  "title": "Python statistics - mean, median, stdev, quantiles and correlation without NumPy",
  "columns": [
    "name",
    "source",
    "detail"
  ],
  "rows": [
    {
      "name": "mean(data)",
      "source": "Python docs",
      "detail": "the sample arithmetic mean; keeps Fraction and Decimal types"
    },
    {
      "name": "fmean(data, weights=None)",
      "source": "Python docs",
      "detail": "the mean as a float; runs faster than mean()"
    },
    {
      "name": "median(data)",
      "source": "Python docs",
      "detail": "the middle value, using the mean of middle two; robust to outliers"
    },
    {
      "name": "mode(data)",
      "source": "Python docs",
      "detail": "the single most common data point; the first one on ties"
    },
    {
      "name": "stdev / variance",
      "source": "Python docs",
      "detail": "sample statistics, needing at least two data points"
    },
    {
      "name": "pstdev / pvariance",
      "source": "Python docs",
      "detail": "population statistics"
    },
    {
      "name": "quantiles(data, n=4)",
      "source": "Python docs",
      "detail": "n - 1 cut points; n=10 for deciles, n=100 for percentiles"
    },
    {
      "name": "correlation(x, y)",
      "source": "Python docs",
      "detail": "returns Pearson's coefficient between -1 and +1; method=\"ranked\" gives Spearman's rank correlation."
    },
    {
      "name": "linear_regression(x, y)",
      "source": "Python docs",
      "detail": "returns the slope and intercept estimated by ordinary least squares."
    },
    {
      "name": "NormalDist(mu, sigma)",
      "source": "Python docs",
      "detail": "returns an object where mu represents the arithmetic mean and sigma represents the standard deviation."
    }
  ],
  "related_slugs": [
    "python-collections-containers",
    "python-functools",
    "python-itertools"
  ],
  "license": "CC-BY-4.0",
  "source_license": "PSF-2.0 (Python docs); PSF-2.0 (python/cpython (GitHub)); prose restates cited source lines in own words",
  "as_of": "2026-11-18",
  "status": "fill-draft-20261118",
  "note": "Restated from the note's GREEN sources; check those sources before relying on a value."
}