code: def _perm_pval(bootstat, estimate, alternative="two-sided"):
      """
      Compute p-values from a permutation test.
  
      Parameters
      ----------
      bootstat : 1D array
          Permutation distribution.
      estimate : float or int
          Point estimate.
      alternative : str
          Tail for p-value. Can be either `'two-sided'` (default), `'greater'` or `'less'`.
  
      Returns
      -------
      p : float
          P-value.
      """
      assert alternative in [
          "two-sided",
          "greater",
          "less",
      ], "Wrong tail argument."
      assert isinstance(estimate, (int, float))
      bootstat = np.asarray(bootstat)
      assert bootstat.ndim == 1, "bootstat must be a 1D array."
      n_boot = bootstat.size
      assert n_boot >= 1, "bootstat must have at least one value."
      if alternative == "greater":
          p = np.greater_equal(bootstat, estimate).sum() / n_boot
      elif alternative == "less":
          p = np.less_equal(bootstat, estimate).sum() / n_boot
      else:
          p = (
              np.greater_equal(np.fabs(bootstat), abs(estimate)).sum()
              / n_boot
          )
      return p
  
file_path: pingouin/pingouin/utils.py
imports: import numbers
  import numpy
  import pandas
  import itertools
  import collections.abc
  from tabulate import tabulate
  from .config import options
label_desc: Use image node_id 1 for calling a global function with example usage: _perm_pval(bootstat, estimate, alternative) and returns: p