code: def _apply_row_additions(
      df: pd.DataFrame,
      added_rows: List[Dict[str, Any]],
      dataframe_schema: DataframeSchema,
  ) -> None:
      """Apply row additions to the provided dataframe (inplace).
  
      Parameters
      ----------
      df : pd.DataFrame
          The dataframe to apply the row additions to.
  
      added_rows : List[Dict[str, Any]]
          A list of row additions. Each row addition is a dictionary with the
          column position as key and the new cell value as value.
  
      dataframe_schema: DataframeSchema
          The schema of the dataframe.
      """
      if not added_rows:
          return
  
      # This is only used if the dataframe has a range index:
      # There seems to be a bug in older pandas versions with RangeIndex in
      # combination with loc. As a workaround, we manually track the values here:
      range_index_stop = None
      range_index_step = None
      if isinstance(df.index, pd.RangeIndex):
          range_index_stop = df.index.stop
          range_index_step = df.index.step
  
      for added_row in added_rows:
          index_value = None
          new_row: List[Any] = [None for _ in range(df.shape[1])]
          for col_name in added_row.keys():
              value = added_row[col_name]
              if col_name == INDEX_IDENTIFIER:
                  # TODO(lukasmasuch): To support multi-index in the future:
                  # use a tuple of values here instead of a single value
                  index_value = _parse_value(
                      value, dataframe_schema[INDEX_IDENTIFIER]
                  )
              else:
                  col_pos = df.columns.get_loc(col_name)
                  new_row[col_pos] = _parse_value(
                      value, dataframe_schema[col_name]
                  )
          # Append the new row to the dataframe
          if range_index_stop is not None:
              df.loc[range_index_stop, :] = new_row
              # Increment to the next range index value
              range_index_stop += range_index_step
          elif index_value is not None:
              # TODO(lukasmasuch): we are only adding rows that have a non-None index
              # value to prevent issues in the frontend component. Also, it just overwrites
              # the row in case the index value already exists in the dataframe.
              # In the future, it would be better to require users to provide unique
              # non-None values for the index with some kind of visual indications.
              df.loc[index_value, :] = new_row
  
imports: from __future__ import annotations
  import json
  from dataclasses import dataclass
  from decimal import Decimal
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, Optional, Set, Tuple, TypeVar, Union, cast, overload
  import pandas
  import pyarrow
  from typing_extensions import Literal, TypeAlias, TypedDict
  from streamlit import logger
  from streamlit import type_util
  from streamlit.deprecation_util import deprecate_func_name
  from streamlit.elements.form import current_form_id
  from streamlit.elements.lib.column_config_utils import INDEX_IDENTIFIER, ColumnConfigMapping, ColumnConfigMappingInput, ColumnDataKind, DataframeSchema, apply_data_specific_configs, determine_dataframe_schema, is_type_compatible, marshall_column_config, process_config_mapping, update_column_config
  from streamlit.elements.lib.pandas_styler_utils import marshall_styler
  from streamlit.elements.utils import check_callback_rules, check_session_state_rules
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.Arrow_pb2 import Arrow
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.runtime.scriptrunner import get_script_run_ctx
  from streamlit.runtime.state import WidgetArgs, WidgetCallback, WidgetKwargs, register_widget
  from streamlit.runtime.state.common import compute_widget_id
  from streamlit.type_util import DataFormat, DataFrameGenericAlias, Key, is_type, to_key
  from streamlit.util import calc_md5
label_desc: Use image node_id 3 for calling a global function with example usage: _apply_row_additions(df, added_rows, dataframe_schema) without return types