code: def zscore(self, weighted=True, prune=False, hs_dims=None):
          
          counts = self.as_array(weighted=weighted)
          total = self.margin(weighted=weighted)
          colsum = self.margin(axis=0, weighted=weighted)
          rowsum = self.margin(axis=1, weighted=weighted)
          zscore = self._calculate_std_res(counts, total, colsum, rowsum)
  
          if hs_dims:
              zscore = intersperse_hs_in_std_res(self, hs_dims, zscore)
  
          if prune:
              return self._apply_pruning_mask(zscore, hs_dims)
  
          return zscore
docs: Return ndarray with slices's standardized residuals (Z-scores).
  
          (Only applicable to a 2D contingency tables.) The Z-score or
          standardized residual is the difference between observed and expected
          cell counts if row and column variables were independent divided
          by the residual cell variance. They are assumed to come from a N(0,1)
          or standard Normal distribution, and can show which cells deviate from
          the null hypothesis that the row and column variables are uncorrelated.
  
          See also *pairwise_chisq*, *pairwise_pvals* for a pairwise column-
          or row-based test of statistical significance.
  
          :param weighted: Use weighted counts for zscores
          :param prune: Prune based on unweighted counts
          :param hs_dims: Include headers and subtotals (as NaN values)
          :returns zscore: ndarray representing cell standardized residuals (Z)