code: def _replace_none_categorical(f: np.ndarray) -> np.ndarray:
      """Replaces missing values in a ordinal feature."""
      if np.all(np.isnan(f)):
          return np.full_like(f, _NONE_NUM)
      # Replace the missing value with a large enough float value so that when
      # looking for k nearest neighbors, samples with missing values are treated
      # separately (only samples with the same missing values are taken into account
      # for nearest neighbors).
      return np.nan_to_num(
          f, copy=True, nan=2 * np.nanmax(f) - np.nanmin(f) + _NONE_NUM
      )
  
imports: import functools
  import itertools
  import math
  from typing import Any, List, Optional, Tuple, Union
  import uuid
  import numpy
  import pandas
  import scipy.special
  import sklearn.neighbors
label_desc: Use image node_id 6 for calling a global function with example usage: _replace_none_categorical(f) and returns: np, np