code: def test_transform(string_series, by_row):
      # transforming functions
  
      with np.errstate(all="ignore"):
          f_sqrt = np.sqrt(string_series)
          f_abs = np.abs(string_series)
  
          # ufunc
          result = string_series.apply(np.sqrt, by_row=by_row)
          expected = f_sqrt.copy()
          tm.assert_series_equal(result, expected)
  
          # list-like
          result = string_series.apply([np.sqrt], by_row=by_row)
          expected = f_sqrt.to_frame().copy()
          expected.columns = ["sqrt"]
          tm.assert_frame_equal(result, expected)
  
          result = string_series.apply(["sqrt"], by_row=by_row)
          tm.assert_frame_equal(result, expected)
  
          # multiple items in list
          # these are in the order as if we are applying both functions per
          # series and then concatting
          expected = concat([f_sqrt, f_abs], axis=1)
          expected.columns = ["sqrt", "absolute"]
          result = string_series.apply([np.sqrt, np.abs], by_row=by_row)
          tm.assert_frame_equal(result, expected)
  
          # dict, provide renaming
          expected = concat([f_sqrt, f_abs], axis=1)
          expected.columns = ["foo", "bar"]
          expected = expected.unstack().rename("series")
  
          result = string_series.apply(
              {"foo": np.sqrt, "bar": np.abs}, by_row=by_row
          )
          tm.assert_series_equal(
              result.reindex_like(expected), expected
          )
  
imports: import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, MultiIndex, Series, concat, date_range, timedelta_range
  import pandas._testing
  from pandas.tests.apply.common import series_transform_kernels
label_desc: Use image node_id 19 for calling a global function with example usage: test_transform(string_series, by_row) without return types