<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pvals(self, weighted=True, prune=False, hs_dims=None):
 """Return 2D ndarray with calculated P values This function calculates statistically significant cells for categorical contingency tables under the null hypothesis that the row and column variables are independent (uncorrelated). The values are calculated for 2D tables only. :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: 2 or 3 Dimensional ndarray, representing the p-values for each cell of the table-like representation of the crunch cube. """

        stats = self.zscore(weighted=weighted, prune=prune, hs_dims=hs_dims)
        pvals = 2 * (1 - norm.cdf(np.abs(stats)))

        return self._apply_pruning_mask(pvals, hs_dims) if prune else pvals