class_docstr: Abstract base class for all KBinsDiscretizers.
  
  Essentially a thin wraper around ``pd.cut``.
  
  Expects either ``self.stats_`` or ``self.bins`` to be set and
  contain {column:list_of_bin_intervals}.
class_docstr_tok: ["Abstract","base","class","for","all","KBinsDiscretizers",".","Essentially","a","thin","wraper","around","``","pd.cut","``",".","Expects","either","``","self.stats_","``","or","``","self.bins","``","to","be","set","and","contain","{","column",":","list_of_bin_intervals","}","."]
code: def _transform_pandas(self, df: pd.DataFrame):
      def bin_values(s: pd.Series) -> pd.Series:
          if s.name not in self.columns:
              return s
          labels = self.dtypes.get(s.name) if self.dtypes else False
          ordered = True
          if labels:
              if isinstance(labels, pd.CategoricalDtype):
                  ordered = labels.ordered
                  labels = list(labels.categories)
              else:
                  labels = False
  
          bins = self.stats_ if self._is_fittable else self.bins
          return pd.cut(
              s,
              bins[s.name] if isinstance(bins, dict) else bins,
              right=self.right,
              labels=labels,
              ordered=ordered,
              retbins=False,
              include_lowest=self.include_lowest,
              duplicates=self.duplicates,
          )
  
      return df.apply(bin_values, axis=0)
  
imports: from typing import Dict, Iterable, List, Optional, Type, Union
  import numpy
  import pandas
  from ray.data import Dataset
  from ray.data.aggregate import Max, Min
  from ray.data.preprocessor import Preprocessor
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 1 for calling the _AbstractKBinsDiscretizer obj's underlying member method code with example usage: obj._transform_pandas(df) and returns: df, pd, s