{
  "name": "pandas.crosstab normalize settings: denominator and worked-example values",
  "description": "Compares the four normalize settings of pandas.crosstab (False, 'index', 'columns', 'all'): what each cell is divided by, per the pandas reference, and the resulting value for the 'improved' column in a 16-row synthetic example (site A n=6, site B n=10) computed by running the code under pandas 3.1.1.",
  "page": "https://casrai.org/guides/pandas-crosstab",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-14T12:52:29Z",
  "temporalCoverage": null,
  "spatialCoverage": null,
  "columns": [
    {
      "name": "normalize setting",
      "unit": "",
      "description": ""
    },
    {
      "name": "Each cell is divided by",
      "unit": "",
      "description": ""
    },
    {
      "name": "Site A, improved",
      "unit": "",
      "description": "Count or proportion for site A, outcome improved"
    },
    {
      "name": "Site B, improved",
      "unit": "",
      "description": "Count or proportion for site B, outcome improved"
    }
  ],
  "rows": [
    {
      "normalize setting": "False (default)",
      "Each cell is divided by": "Nothing (raw counts)",
      "Site A, improved": 3,
      "Site B, improved": 3
    },
    {
      "normalize setting": "'index'",
      "Each cell is divided by": "Its row total",
      "Site A, improved": 0.5,
      "Site B, improved": 0.3
    },
    {
      "normalize setting": "'columns'",
      "Each cell is divided by": "Its column total",
      "Site A, improved": 0.5,
      "Site B, improved": 0.5
    },
    {
      "normalize setting": "'all' or True",
      "Each cell is divided by": "The grand total (16)",
      "Site A, improved": 0.1875,
      "Site B, improved": 0.1875
    }
  ],
  "sources": [
    {
      "title": "pandas documentation: pandas.crosstab",
      "url": "https://pandas.pydata.org/docs/reference/api/pandas.crosstab.html",
      "accessed": "2026-11-14"
    }
  ]
}