{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function preserves ndarray subclasses, and works also with matrices and masked arrays (it uses "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "asanyarray"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " instead of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "asarray"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for parameters)."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 1.8"
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "gzscore",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The geometric z scores, standardized by geometric mean and geometric standard deviation of input array "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the geometric standard score."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "a",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Sample data."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int or None, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis along which to operate. Default is 0. If None, compute over the whole array "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "ddof",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Degrees of freedom correction in the calculation of the standard deviation. Default is 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "nan_policy",
              "annotation": "{'propagate', 'raise', 'omit'}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Defines how to handle when input contains nan. 'propagate' returns nan, 'raise' throws an error, 'omit' performs the calculations ignoring nan values. Default is 'propagate'.  Note that when the value is 'omit', nans in the input also propagate to the output, but they do not affect the geometric z scores computed for the non-nan values."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the geometric z score of each strictly positive value in the sample, relative to the geometric mean and standard deviation. Mathematically the geometric z score can be evaluated as      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "gzscore = log(a/gmu) / log(gsigma)",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "gmu"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (resp. "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "gsigma"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") is the geometric mean (resp. standard deviation)."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "build-install/usr/lib/python3.14/site-packages/scipy/stats/_stats_py.py",
  "item_line": 2767,
  "item_type": "function",
  "aliases": [
    "scipy.stats.gzscore"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Draw samples from a log-normal distribution:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.stats import zscore, gzscore\nimport matplotlib.pyplot as plt\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "rng = np.random.default_rng()\nmu, sigma = 3., 1.  # mean and standard deviation\nx = rng.lognormal(mu, sigma, size=500)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDisplay the histogram of the samples:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig, ax = plt.subplots()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.hist(x, 50)\n",
        "execution_status": "failure",
        "out": "(array([ 84., 113.,  75.,  52.,  42.,  27.,  25.,  12.,   7.,   8.,   7.,\n         8.,   5.,   4.,   3.,   1.,   3.,   3.,   2.,   3.,   1.,   3.,\n         2.,   2.,   1.,   0.,   1.,   0.,   3.,   0.,   0.,   0.,   0.,\n         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   1.,\n         0.,   1.,   0.,   0.,   0.,   1.]), array([  1.21153,   8.23655,  15.26158,  22.2866 ,  29.31162,  36.33665,\n        43.36167,  50.3867 ,  57.41172,  64.43674,  71.46177,  78.48679,\n        85.51181,  92.53684,  99.56186, 106.58689, 113.61191, 120.63693,\n       127.66196, 134.68698, 141.71201, 148.73703, 155.76205, 162.78708,\n       169.8121 , 176.83712, 183.86215, 190.88717, 197.9122 , 204.93722,\n       211.96224, 218.98727, 226.01229, 233.03732, 240.06234, 247.08736,\n       254.11239, 261.13741, 268.16243, 275.18746, 282.21248, 289.23751,\n       296.26253, 303.28755, 310.31258, 317.3376 , 324.36263, 331.38765,\n       338.41267, 345.4377 , 352.46272]), <BarContainer object of 50 artists>)\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "2.0.0.dev0+git20260907.41eeb59",
          "kind": "assets",
          "path": "fig-48cc4f3c28aea2e3.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDisplay the histogram of the samples standardized by the classical zscore.\nDistribution is rescaled but its shape is unchanged.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig, ax = plt.subplots()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.hist(zscore(x), 50)\n",
        "execution_status": "failure",
        "out": "(array([ 84., 113.,  75.,  52.,  42.,  27.,  25.,  12.,   7.,   8.,   7.,\n         8.,   5.,   4.,   3.,   1.,   3.,   3.,   2.,   3.,   1.,   3.,\n         2.,   2.,   1.,   0.,   1.,   0.,   3.,   0.,   0.,   0.,   0.,\n         0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   1.,\n         0.,   1.,   0.,   0.,   0.,   1.]), array([-0.78032, -0.61008, -0.43984, -0.26961, -0.09937,  0.07087,\n        0.24111,  0.41134,  0.58158,  0.75182,  0.92206,  1.09229,\n        1.26253,  1.43277,  1.60301,  1.77324,  1.94348,  2.11372,\n        2.28396,  2.45419,  2.62443,  2.79467,  2.96491,  3.13514,\n        3.30538,  3.47562,  3.64586,  3.81609,  3.98633,  4.15657,\n        4.32681,  4.49704,  4.66728,  4.83752,  5.00776,  5.17799,\n        5.34823,  5.51847,  5.68871,  5.85894,  6.02918,  6.19942,\n        6.36966,  6.53989,  6.71013,  6.88037,  7.05061,  7.22084,\n        7.39108,  7.56132,  7.73156]), <BarContainer object of 50 artists>)\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "2.0.0.dev0+git20260907.41eeb59",
          "kind": "assets",
          "path": "fig-cca9704e6fbd1c2f.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDemonstrate that the distribution of geometric zscores is rescaled and\nquasinormal:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig, ax = plt.subplots()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.hist(gzscore(x), 50)\n",
        "execution_status": "failure",
        "out": "(array([ 2.,  2.,  0.,  0.,  2.,  0.,  3.,  5.,  3.,  2.,  7.,  9., 11.,\n        8., 13.,  7., 14., 15., 14., 23., 23., 26., 25., 21., 18., 26.,\n       21., 24., 21., 23., 14., 19., 17., 12.,  7.,  9.,  8., 10.,  6.,\n        3.,  6.,  5.,  5.,  4.,  2.,  2.,  0.,  0.,  1.,  2.]), array([-2.84847, -2.73393, -2.61939, -2.50485, -2.39031, -2.27577,\n       -2.16123, -2.04669, -1.93215, -1.81761, -1.70307, -1.58853,\n       -1.47399, -1.35945, -1.24491, -1.13037, -1.01583, -0.90129,\n       -0.78675, -0.67221, -0.55767, -0.44313, -0.32859, -0.21405,\n       -0.09951,  0.01503,  0.12958,  0.24412,  0.35866,  0.4732 ,\n        0.58774,  0.70228,  0.81682,  0.93136,  1.0459 ,  1.16044,\n        1.27498,  1.38952,  1.50406,  1.6186 ,  1.73314,  1.84768,\n        1.96222,  2.07676,  2.1913 ,  2.30584,  2.42038,  2.53492,\n        2.64946,  2.764  ,  2.87854]), <BarContainer object of 50 artists>)\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "2.0.0.dev0+git20260907.41eeb59",
          "kind": "assets",
          "path": "fig-892961b85d3f4ac2.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "gmean",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._stats_py:gmean"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Geometric mean"
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "gstd",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._stats_py:gstd"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Geometric standard deviation"
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "zscore",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._stats_py:zscore"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Standard score"
            }
          ]
        }
      ],
      "type": "func"
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "a",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "ddof",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "nan_policy",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "propagate"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "gzscore"
  },
  "references": [
    ".. [1] \"Geometric standard score\", *Wikipedia*,",
    "       https://en.wikipedia.org/wiki/Geometric_standard_deviation#Geometric_standard_score."
  ],
  "qa": "scipy.stats._stats_py:gzscore",
  "arbitrary": [],
  "local_refs": [
    "a",
    "axis",
    "ddof",
    "gzscore",
    "nan_policy"
  ]
}