code: def _is_injective_mapping(
      df: pd.DataFrame,
      source: str,
      target: str,
  ) -> Tuple[int, float]:
      """
      (Soft-)Determine whether there is an injective mapping from source to target.
  
      :param df:
          The dataframe.
      :param source:
          The source column.
      :param target:
          The target column.
  
      :return:
          The number of unique source values, and the relative frequency of unique target per source.
      """
      grouped = df.groupby(by=source)
      support = len(grouped)
      n_unique = grouped.agg({target: "nunique"})[target]
      conf = (n_unique <= 1).mean()
      return support, conf
  
imports: import hashlib
  import itertools
  import logging
  from collections import defaultdict
  from typing import Collection, DefaultDict, Iterable, Mapping, NamedTuple, Optional, Sequence, Set, Tuple, Union
  import numpy
  import pandas
  from tqdm.auto import tqdm
  from .None import TriplesFactory
  from ..constants import COLUMN_LABELS, TARGET_TO_INDEX
  from ..typing import COLUMN_HEAD, COLUMN_RELATION, COLUMN_TAIL, LABEL_HEAD, LABEL_RELATION, LABEL_TAIL, MappedTriples
label_desc: Use image node_id 13 for calling a global function with example usage: _is_injective_mapping(df, source, target) and returns: support,  conf