code: def nargminmax(
      values: ExtensionArray, method: str, axis: AxisInt = 0
  ):
      """
      Implementation of np.argmin/argmax but for ExtensionArray and which
      handles missing values.
  
      Parameters
      ----------
      values : ExtensionArray
      method : {"argmax", "argmin"}
      axis : int, default 0
  
      Returns
      -------
      int
      """
      assert method in {"argmax", "argmin"}
      func = np.argmax if method == "argmax" else np.argmin
  
      mask = np.asarray(isna(values))
      arr_values = values._values_for_argsort()
  
      if arr_values.ndim > 1:
          if mask.any():
              if axis == 1:
                  zipped = zip(arr_values, mask)
              else:
                  zipped = zip(arr_values.T, mask.T)
              return np.array(
                  [_nanargminmax(v, m, func) for v, m in zipped]
              )
          return func(arr_values, axis=axis)
  
      return _nanargminmax(arr_values, mask, func)
  
imports: from __future__ import annotations
  from collections import defaultdict
  from typing import TYPE_CHECKING, Callable, DefaultDict, cast
  import numpy
  from pandas._libs import algos, hashtable, lib
  from pandas._libs.hashtable import unique_label_indices
  from pandas.core.dtypes.common import ensure_int64, ensure_platform_int
  from pandas.core.dtypes.generic import ABCMultiIndex, ABCRangeIndex
  from pandas.core.dtypes.missing import isna
  from pandas.core.construction import extract_array
label_desc: Use image node_id 9 for calling a global function with example usage: nargminmax(values, method, axis) and returns: _nanargminmax, func, np