code: def test_max_abs_scaler():
      """Tests basic MaxAbsScaler functionality."""
      col_a = [-1, 0, 1]
      col_b = [1, 3, -5]
      col_c = [1, 1, None]
      in_df = pd.DataFrame.from_dict(
          {"A": col_a, "B": col_b, "C": col_c}
      )
      ds = ray.data.from_pandas(in_df)
  
      scaler = MaxAbsScaler(["B", "C"])
  
      # Transform with unfitted preprocessor.
      with pytest.raises(PreprocessorNotFittedException):
          scaler.transform(ds)
  
      # Fit data.
      scaler.fit(ds)
      assert scaler.stats_ == {"abs_max(B)": 5, "abs_max(C)": 1}
  
      transformed = scaler.transform(ds)
      out_df = transformed.to_pandas()
  
      processed_col_a = col_a
      processed_col_b = [0.2, 0.6, -1.0]
      processed_col_c = [1.0, 1.0, None]
      expected_df = pd.DataFrame.from_dict(
          {
              "A": processed_col_a,
              "B": processed_col_b,
              "C": processed_col_c,
          }
      )
  
      assert out_df.equals(expected_df)
  
      # Transform batch.
      pred_col_a = [1, 2, 3]
      pred_col_b = [3, 5, 7]
      pred_col_c = [0, 1, -2]
      pred_in_df = pd.DataFrame.from_dict(
          {"A": pred_col_a, "B": pred_col_b, "C": pred_col_c}
      )
  
      pred_out_df = scaler.transform_batch(pred_in_df)
  
      pred_processed_col_a = pred_col_a
      pred_processed_col_b = [0.6, 1.0, 1.4]
      pred_processed_col_c = [0.0, 1.0, -2.0]
      pred_expected_df = pd.DataFrame.from_dict(
          {
              "A": pred_processed_col_a,
              "B": pred_processed_col_b,
              "C": pred_processed_col_c,
          }
      )
  
      assert pred_out_df.equals(pred_expected_df)
  
file_path: ray/python/ray/data/tests/preprocessors/test_scaler.py
imports: import pandas
  import pytest
  import ray
  from ray.data.preprocessor import PreprocessorNotFittedException
  from ray.data.preprocessors import MaxAbsScaler, MinMaxScaler, RobustScaler, StandardScaler
label_desc: Use image node_id 2 for calling a global function with example usage: test_max_abs_scaler() without return types