class_docstr: Encode labels as integer targets.
  
  :class:`LabelEncoder` encodes labels as integer targets that range from
  :math:`0` to :math:`n - 1`, where :math:`n` is the number of unique labels.
  
  If you transform a label that isn't in the fitted datset, then the label is encoded
  as ``float("nan")``.
  
  Examples:
      >>> import pandas as pd
      >>> import ray
      >>> df = pd.DataFrame({
      ...     "sepal_width": [5.1, 7, 4.9, 6.2],
      ...     "sepal_height": [3.5, 3.2, 3, 3.4],
      ...     "species": ["setosa", "versicolor", "setosa", "virginica"]
      ... })
      >>> ds = ray.data.from_pandas(df)  # doctest: +SKIP
      >>>
      >>> from ray.data.preprocessors import LabelEncoder
      >>> encoder = LabelEncoder(label_column="species")
      >>> encoder.fit_transform(ds).to_pandas()  # doctest: +SKIP
         sepal_width  sepal_height  species
      0          5.1           3.5        0
      1          7.0           3.2        1
      2          4.9           3.0        0
      3          6.2           3.4        2
  
      If you transform a label not present in the original dataset, then the new
      label is encoded as ``float("nan")``.
  
      >>> df = pd.DataFrame({
      ...     "sepal_width": [4.2],
      ...     "sepal_height": [2.7],
      ...     "species": ["bracteata"]
      ... })
      >>> ds = ray.data.from_pandas(df)  # doctest: +SKIP
      >>> encoder.transform(ds).to_pandas()  # doctest: +SKIP
         sepal_width  sepal_height  species
      0          4.2           2.7      NaN
  
  Args:
      label_column: A column containing labels that you want to encode.
  
  .. seealso::
  
      :class:`OrdinalEncoder`
          If you're encoding ordered features, use :class:`OrdinalEncoder` instead of
          :class:`LabelEncoder`.
class_docstr_tok: ["Encode","labels","as","integer","targets",".",":","class",":","`","LabelEncoder","`","encodes","labels","as","integer","targets","that","range","from",":","math",":","`","0","`","to",":","math",":","`","n","-","1","`",",","where",":","math",":","`","n","`","is","the","number","of","unique","labels",".","If","you","transform","a","label","that","is","n't","in","the","fitted","datset",",","then","the","label","is","encoded","as","``","float","(","``","nan","''",")","``",".","Examples",":",">",">",">","import","pandas","as","pd",">",">",">","import","ray",">",">",">","df","=","pd.DataFrame","(","{","...","``","sepal_width","''",":","[","5.1",",","7",",","4.9",",","6.2","]",",","...","``","sepal_height","''",":","[","3.5",",","3.2",",","3",",","3.4","]",",","...","``","species","''",":","[","``","setosa","''",",","``","versicolor","''",",","``","setosa","''",",","``","virginica","''","]","...","}",")",">",">",">","ds","=","ray.data.from_pandas","(","df",")","#","doctest",":","+SKIP",">",">",">",">",">",">","from","ray.data.preprocessors","import","LabelEncoder",">",">",">","encoder","=","LabelEncoder","(","label_column=","''","species","''",")",">",">",">","encoder.fit_transform","(","ds",")",".to_pandas","(",")","#","doctest",":","+SKIP","sepal_width","sepal_height","species","0","5.1","3.5","0","1","7.0","3.2","1","2","4.9","3.0","0","3","6.2","3.4","2","If","you","transform","a","label","not","present","in","the","original","dataset",",","then","the","new","label","is","encoded","as","``","float","(","``","nan","''",")","``",".",">",">",">","df","=","pd.DataFrame","(","{","...","``","sepal_width","''",":","[","4.2","]",",","...","``","sepal_height","''",":","[","2.7","]",",","...","``","species","''",":","[","``","bracteata","''","]","...","}",")",">",">",">","ds","=","ray.data.from_pandas","(","df",")","#","doctest",":","+SKIP",">",">",">","encoder.transform","(","ds",")",".to_pandas","(",")","#","doctest",":","+SKIP","sepal_width","sepal_height","species","0","4.2","2.7","NaN","Args",":","label_column",":","A","column","containing","labels","that","you","want","to","encode",".","..","seealso",":",":",":","class",":","`","OrdinalEncoder","`","If","you","'re","encoding","ordered","features",",","use",":","class",":","`","OrdinalEncoder","`","instead","of",":","class",":","`","LabelEncoder","`","."]
code: def _transform_pandas(self, df: pd.DataFrame):
      _validate_df(df, self.label_column)
  
      def column_label_encoder(s: pd.Series):
          s_values = self.stats_[f"unique_values({s.name})"]
          return s.map(s_values)
  
      df[self.label_column] = df[self.label_column].transform(
          column_label_encoder
      )
      return df
  
imports: from collections import Counter, OrderedDict
  from functools import partial
  from typing import Dict, List, Optional
  import numpy
  import pandas
  import pandas.api.types
  from ray.air.util.data_batch_conversion import BatchFormat
  from ray.data import Dataset
  from ray.data.preprocessor import Preprocessor, PreprocessorNotFittedException
  from ray.util.annotations import PublicAPI
label_desc: Use image node_id 3 for calling the LabelEncoder obj's underlying member method code with example usage: obj._transform_pandas(df) and returns: df, s