code: def _dichotomize_series(data, column):
      """Converts the values of a pd.DataFrame column into 0 or 1"""
      series = data[column]
      if series.dtype == bool:
          return series.astype(int)
  
      def convert_elem(elem):
          if isinstance(elem, (int, float)) and elem in (0, 1):
              return int(elem)
          if isinstance(elem, str):
              lower = elem.lower()
              if lower in (
                  "n",
                  "no",
                  "absent",
                  "false",
                  "f",
                  "negative",
              ):
                  return 0
              elif lower in (
                  "y",
                  "yes",
                  "present",
                  "true",
                  "t",
                  "positive",
                  "p",
              ):
                  return 1
          raise ValueError(
              "Invalid value to build a 2x2 contingency "
              "table on column {}: {}".format(column, elem)
          )
  
      return series.apply(convert_elem)
  
file_path: pingouin/pingouin/contingency.py
imports: import warnings
  import numpy
  import pandas
  from scipy.stats.contingency import expected_freq
  from scipy.stats import power_divergence, binom, chi2
  from pingouin import power_chi2, _postprocess_dataframe
label_desc: Use image node_id 3 for calling a global function with example usage: _dichotomize_series(data, column) and returns: series, series, int, int, int