code: def _append_columns(
      base_df: DataFrame, append_df: DataFrame, columns: dict[str, str]
  ) -> DataFrame:
      """
      Function for adding columns from one DataFrame to another DataFrame. Calls the
      assign method, which overwrites the original column in `base_df` if the column
      already exists, and appends the column if the name is not defined.
  
      Note that! this is a memory-intensive operation.
  
      :param base_df: DataFrame which to use as the base
      :param append_df: DataFrame from which to select data.
      :param columns: columns on which to append, mapping source column to
             target column. For instance, `{'y': 'y'}` will replace the values in
             column `y` in `base_df` with the values in `y` in `append_df`,
             while `{'y': 'y2'}` will add a column `y2` to `base_df` based
             on values in column `y` in `append_df`, leaving the original column `y`
             in `base_df` unchanged.
      :return: new DataFrame with combined data from `base_df` and `append_df`
      """
      if all(key == value for key, value in columns.items()):
          # make sure to return a new DataFrame instead of changing the `base_df`.
          _base_df = base_df.copy()
          _base_df.loc[:, columns.keys()] = append_df
          return _base_df
      append_df = append_df.rename(columns=columns)
      return pd.concat([base_df, append_df], axis="columns")
  
file_path: superset/superset/utils/pandas_postprocessing/utils.py
imports: from collections.abc import Sequence
  from functools import partial
  from typing import Any, Callable
  import numpy
  import pandas
  from flask_babel import gettext
  from pandas import DataFrame, NamedAgg
  from superset.constants import TimeGrain
  from superset.exceptions import InvalidPostProcessingError
label_desc: Use image node_id 5 for calling a global function with example usage: _append_columns(base_df, append_df, columns) and returns: pd, _base_df