code: def nanmedian(values, axis=None, skipna=True, mask=None):
      """
      Parameters
      ----------
      values : ndarray
      axis: int, optional
      skipna : bool, default True
      mask : ndarray[bool], optional
          nan-mask if known
  
      Returns
      -------
      result : float
          Unless input is a float array, in which case use the same
          precision as the input array.
  
      Examples
      --------
      >>> import pandas.core.nanops as nanops
      >>> s = pd.Series([1, np.nan, 2, 2])
      >>> nanops.nanmedian(s)
      2.0
      """
  
      def get_median(x):
          mask = notna(x)
          if not skipna and not mask.all():
              return np.nan
          return np.nanmedian(x[mask])
  
      values, mask, dtype, dtype_max, _ = _get_values(
          values, skipna, mask=mask
      )
      if not is_float_dtype(values):
          values = values.astype("f8")
          values[mask] = np.nan
  
      if axis is None:
          values = values.ravel()
  
      notempty = values.size
  
      # an array from a frame
      if values.ndim > 1:
          # there's a non-empty array to apply over otherwise numpy raises
          if notempty:
              if not skipna:
                  return _wrap_results(
                      np.apply_along_axis(get_median, axis, values),
                      dtype,
                  )
  
              # fastpath for the skipna case
              return _wrap_results(np.nanmedian(values, axis), dtype)
  
          # must return the correct shape, but median is not defined for the
          # empty set so return nans of shape "everything but the passed axis"
          # since "axis" is where the reduction would occur if we had a nonempty
          # array
          shp = np.array(values.shape)
          dims = np.arange(values.ndim)
          ret = np.empty(shp[dims != axis])
          ret.fill(np.nan)
          return _wrap_results(ret, dtype)
  
      # otherwise return a scalar value
      return _wrap_results(
          get_median(values) if notempty else np.nan, dtype
      )
  
imports: from distutils.version import LooseVersion
  import functools
  import itertools
  import operator
  import warnings
  import numpy
  from pandas._libs import iNaT, lib, tslibs
  import pandas.compat
  from pandas.core.dtypes.cast import _int64_max, maybe_upcast_putmask
  from pandas.core.dtypes.common import _get_dtype, is_any_int_dtype, is_bool_dtype, is_complex, is_complex_dtype, is_datetime64_dtype, is_datetime64tz_dtype, is_datetime_or_timedelta_dtype, is_float, is_float_dtype, is_integer, is_integer_dtype, is_numeric_dtype, is_object_dtype, is_scalar, is_timedelta64_dtype, pandas_dtype
  from pandas.core.dtypes.dtypes import DatetimeTZDtype
  from pandas.core.dtypes.missing import isna, na_value_for_dtype, notna
  import pandas.core.common
  from pandas.core.config import get_option
label_desc: Use image node_id 14 for calling a global function with example usage: nanmedian(values, axis, skipna, mask) and returns: _wrap_results, np, _wrap_results, np, _wrap_results, _wrap_results