code: def _nanpercentile_1d(
      values: np.ndarray,
      mask: npt.NDArray[np.bool_],
      qs: npt.NDArray[np.float64],
      na_value: Scalar,
      interpolation: str,
  ) -> Scalar | np.ndarray:
      """
      Wrapper for np.percentile that skips missing values, specialized to
      1-dimensional case.
  
      Parameters
      ----------
      values : array over which to find quantiles
      mask : ndarray[bool]
          locations in values that should be considered missing
      qs : np.ndarray[float64] of quantile indices to find
      na_value : scalar
          value to return for empty or all-null values
      interpolation : str
  
      Returns
      -------
      quantiles : scalar or array
      """
      # mask is Union[ExtensionArray, ndarray]
      values = values[~mask]
  
      if len(values) == 0:
          # Can't pass dtype=values.dtype here bc we might have na_value=np.nan
          #  with values.dtype=int64 see test_quantile_empty
          # equiv: 'np.array([na_value] * len(qs))' but much faster
          return np.full(len(qs), na_value)
  
      return np.percentile(
          values,
          qs,
          # error: No overload variant of "percentile" matches argument
          # types "ndarray[Any, Any]", "ndarray[Any, dtype[floating[_64Bit]]]"
          # , "Dict[str, str]"  [call-overload]
          **{np_percentile_argname: interpolation},  # type: ignore[call-overload]
      )
  
file_path: catboost/contrib/python/pandas/py3/pandas/core/array_algos/quantile.py
imports: from __future__ import annotations
  import numpy
  from pandas._typing import ArrayLike, Scalar, npt
  from pandas.compat.numpy import np_percentile_argname
  from pandas.core.dtypes.missing import isna, na_value_for_dtype
label_desc: Use image node_id 3 for calling a global function with example usage: _nanpercentile_1d(values, mask, qs, na_value, interpolation) and returns: np, np