code: def apply_replacements(
      df: pd.DataFrame,
      columns: List[str],
      vec: Dict[str, Dict],
      replace_unseen: Any,
  ) -> pd.DataFrame:
      """
      Base function to apply the replacements values found on the
      "vec" vectors into the df DataFrame.
  
      Parameters
      -----------
  
      df: pandas.DataFrame
          A Pandas DataFrame containing the data to be replaced.
  
      columns : list of str
          The df columns names to perform the replacements.
  
      vec: dict
          A dict mapping a col to dict mapping a value to its replacement. For example:
          vec = {"feature1": {1: 2, 3: 5, 6: 8}}
  
      replace_unseen: Any
          Default value to replace when original value is not present in the `vec` dict for the feature
  
      """
      column_categorizer = lambda col: df[col].apply(
          lambda x: (
              np.nan
              if isinstance(x, float) and np.isnan(x)
              else vec[col].get(x, replace_unseen)
          )
      )
      categ_columns = {col: column_categorizer(col) for col in columns}
      return df.assign(**categ_columns)
  
imports: from typing import Any, Callable, Dict, List, Union, Optional
  import numpy
  import pandas
  from numpy import nan
  from sklearn.preprocessing import StandardScaler
  from statsmodels.distributions import empirical_distribution
  from toolz import curry, merge, compose, mapcat
  from fklearn.common_docstrings import learner_return_docstring, learner_pred_fn_docstring
  from fklearn.training.utils import log_learner_time
  from fklearn.types import LearnerReturnType, LearnerLogType
  from fklearn.preprocessing.schema import column_duplicatable
label_desc: Use image node_id 7 for calling a global function with example usage: apply_replacements(df, columns, vec, replace_unseen) and returns: df