code: def test_nested_chain_state():
      col_a = [-1, -1, 1, 1]
      col_b = [1, 1, 1, None]
      col_c = ["sunday", "monday", "tuesday", "tuesday"]
      in_df = pd.DataFrame.from_dict(
          {"A": col_a, "B": col_b, "C": col_c}
      )
      ds = ray.data.from_pandas(in_df)
  
      def udf(df):
          df["A"] *= 2
          return df
  
      def create_chain():
          batch_mapper = BatchMapper(fn=udf, batch_format="pandas")
          imputer = SimpleImputer(["B"])
          scaler = StandardScaler(["A", "B"])
          encoder = LabelEncoder("C")
          return Chain(Chain(scaler, imputer), encoder, batch_mapper)
  
      chain = create_chain()
      assert chain.fit_status() == Preprocessor.FitStatus.NOT_FITTED
  
      chain = create_chain()
      chain.preprocessors[1].fit(ds)
      assert (
          chain.fit_status() == Preprocessor.FitStatus.PARTIALLY_FITTED
      )
  
      chain = create_chain()
      chain.preprocessors[0].fit(ds)
      assert (
          chain.fit_status() == Preprocessor.FitStatus.PARTIALLY_FITTED
      )
  
      chain.preprocessors[1].fit(ds)
      assert chain.fit_status() == Preprocessor.FitStatus.FITTED
  
      chain = create_chain()
      chain.fit(ds)
      assert chain.fit_status() == Preprocessor.FitStatus.FITTED
  
file_path: ray/python/ray/data/tests/preprocessors/test_chain.py
imports: import pandas
  import pytest
  import ray
  from ray.air.util.data_batch_conversion import BatchFormat
  from ray.data.preprocessor import Preprocessor
  from ray.data.preprocessors import BatchMapper, Chain, LabelEncoder, SimpleImputer, StandardScaler
label_desc: Use image node_id 2 for calling a global function with example usage: test_nested_chain_state() and returns: df, Chain