code: def _masked_column_median(arr, masked_value):
      """Compute the median of each column in the 2D array arr, ignoring any
      instances of masked_value"""
      mask = _get_mask(arr, masked_value)
      if arr.size == 0:
          return cp.full(arr.shape[1], cp.nan)
      if not cp.isnan(masked_value):
          arr_sorted = arr.copy()
          # If nan is not the missing value, any column with nans should
          # have a median of nan
          nan_cols = cp.any(cp.isnan(arr), axis=0)
          arr_sorted[mask] = cp.nan
          arr_sorted.sort(axis=0)
      else:
          nan_cols = cp.full(arr.shape[1], False)
          # nans are always sorted to end of array and the sort call
          # copies the data
          arr_sorted = cp.sort(arr, axis=0)
  
      count_missing_values = mask.sum(axis=0)
      # Ignore missing values in determining "halfway" index of sorted
      # array
      n_elems = arr.shape[0] - count_missing_values
  
      # If no elements remain after removing missing value, median for
      # that column is nan
      nan_cols = cp.logical_or(nan_cols, n_elems <= 0)
  
      col_index = cp.arange(arr_sorted.shape[1])
      median = (
          arr_sorted[cp.floor_divide(n_elems - 1, 2), col_index]
          + arr_sorted[cp.floor_divide(n_elems, 2), col_index]
      ) / 2
  
      median[nan_cols] = cp.nan
      return median
  
file_path: cuml/python/cuml/thirdparty_adapters/adapters.py
imports: from cupyx.scipy import sparse
  from scipy import sparse
  from scipy.sparse import csc_matrix
  from scipy.sparse import csc_matrix
  from cuml.internals.safe_imports import cpu_only_import_from
  from cupyx.scipy.sparse import csc_matrix
  from cuml.internals.safe_imports import gpu_only_import_from
  from cuml.internals.global_settings import GlobalSettings
  from cuml.internals.input_utils import input_to_cupy_array, input_to_host_array
  from cuml.internals.safe_imports import gpu_only_import
  from cuml.internals.safe_imports import cpu_only_import
label_desc: Use image node_id 6 for calling a global function with example usage: _masked_column_median(arr, masked_value) and returns: median, cp