code: def test_map_categorical_with_nan_values(
      data, expected_dtype, using_infer_string
  ):
      # GH 20714 bug fixed in: GH 24275
      def func(val):
          return val.split("-")[0]
  
      s = Series(data, dtype="category")
  
      result = s.map(func, na_action="ignore")
      if using_infer_string and expected_dtype == object:
          expected_dtype = "string[pyarrow_numpy]"
      expected = Series(["1", "1", np.nan], dtype=expected_dtype)
      tm.assert_series_equal(result, expected)
  
imports: from collections import Counter, defaultdict
  from decimal import Decimal
  import math
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, MultiIndex, Series, bdate_range, date_range, isna, timedelta_range
  import pandas._testing
label_desc: Use image node_id 6 for calling a global function with example usage: test_map_categorical_with_nan_values(data, expected_dtype, using_infer_string) and returns: val