code: def test_series_replace():
      a1 = np.array([0, 1, 2, 3, 4])
  
      # Numerical
      a2 = np.array([5, 1, 2, 3, 4])
      sr1 = cudf.Series(a1)
      sr2 = sr1.replace(0, 5)
      assert_eq(a2, sr2.to_numpy())
  
      # Categorical
      psr3 = pd.Series(["one", "two", "three"], dtype="category")
      psr4 = psr3.replace("one", "two")
      sr3 = cudf.from_pandas(psr3)
      sr4 = sr3.replace("one", "two")
      assert_eq(
          psr4.sort_values().reset_index(drop=True),
          sr4.sort_values().reset_index(drop=True),
      )
  
      psr5 = psr3.replace("one", "five")
      sr5 = sr3.replace("one", "five")
  
      assert_eq(psr5, sr5)
  
      # List input
      a6 = np.array([5, 6, 2, 3, 4])
      sr6 = sr1.replace([0, 1], [5, 6])
      assert_eq(a6, sr6.to_numpy())
  
      with pytest.raises(TypeError):
          sr1.replace([0, 1], [5.5, 6.5])
  
      # Series input
      a8 = np.array([5, 5, 5, 3, 4])
      sr8 = sr1.replace(sr1[:3].to_numpy(), 5)
      assert_eq(a8, sr8.to_numpy())
  
      # large input containing null
      sr9 = cudf.Series(list(range(400)) + [None])
      sr10 = sr9.replace([22, 323, 27, 0], None)
      assert sr10.null_count == 5
      assert len(sr10.dropna().to_numpy()) == (401 - 5)
  
      sr11 = sr9.replace([22, 323, 27, 0], -1)
      assert sr11.null_count == 1
      assert len(sr11.dropna().to_numpy()) == (401 - 1)
  
      # large input not containing nulls
      sr9 = sr9.fillna(-11)
      sr12 = sr9.replace([22, 323, 27, 0], None)
      assert sr12.null_count == 4
      assert len(sr12.dropna().to_numpy()) == (401 - 4)
  
      sr13 = sr9.replace([22, 323, 27, 0], -1)
      assert sr13.null_count == 0
      assert len(sr13.to_numpy()) == 401
  
imports: import re
  from decimal import Decimal
  import numpy
  import pandas
  import pytest
  import cudf
  from cudf.core._compat import PANDAS_GE_134, PANDAS_GE_150
  from cudf.core.dtypes import Decimal32Dtype, Decimal64Dtype, Decimal128Dtype
  from cudf.testing._utils import INTEGER_TYPES, NUMERIC_TYPES, assert_eq, assert_exceptions_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_series_replace() without return types