code: def flag_jumps(
      df: pd.DataFrame,
      scale: Union[str, Dict[str, str]] = "percentage",
      direction: Union[str, Dict[str, str]] = "any",
      threshold: Union[int, float, Dict[str, Union[int, float]]] = 0.0,
      strict: bool = False,
  ) -> pd.DataFrame:
      """Create boolean column(s) that flag whether or not the change
      between consecutive rows exceeds a provided threshold.
  
      Examples:
  
          Applies specified criteria across all columns of the DataFrame
          and appends a flag column for each column in the DataFrame
  
          >>> df = (
          ...     pd.DataFrame(...)
          ...     .flag_jumps(
          ...         scale="absolute",
          ...         direction="any",
          ...         threshold=2
          ...     )
          ... )  # doctest: +SKIP
  
          Applies specific criteria to certain DataFrame columns,
          applies default criteria to columns *not* specifically listed and
          appends a flag column for each column in the DataFrame
  
          >>> df = (
          ...     pd.DataFrame(...)
          ...     .flag_jumps(
          ...         scale=dict(col1="absolute", col2="percentage"),
          ...         direction=dict(col1="increasing", col2="any"),
          ...         threshold=dict(col1=1, col2=0.5),
          ...     )
          ... )  # doctest: +SKIP
  
          Applies specific criteria to certain DataFrame columns,
          applies default criteria to columns *not* specifically listed and
          appends a flag column for only those columns found in specified
          criteria
  
          >>> df = (
          ...     pd.DataFrame(...)
          ...     .flag_jumps(
          ...         scale=dict(col1="absolute"),
          ...         threshold=dict(col2=1),
          ...         strict=True,
          ...     )
          ... )  # doctest: +SKIP
  
      Args:
          df: DataFrame which needs to be flagged for changes between
              consecutive rows above a certain threshold.
          scale:
              Type of scaling approach to use.
              Acceptable arguments are
  
              * `'absolute'` (consider the difference between rows)
              * `'percentage'` (consider the percentage change between rows).
  
          direction: Type of method used to handle the sign change when
              comparing consecutive rows.
              Acceptable arguments are
  
              * `'increasing'` (only consider rows that are increasing in value)
              * `'decreasing'` (only consider rows that are decreasing in value)
              * `'any'` (consider rows that are either increasing or decreasing;
                  sign is ignored).
          threshold: The value to check if consecutive row comparisons
              exceed. Always uses a greater than comparison. Must be `>= 0.0`.
          strict: Flag to enable/disable appending of a flag column for
              each column in the provided DataFrame. If set to `True`, will
              only append a flag column for those columns found in at least
              one of the input dictionaries. If set to `False`, will append
              a flag column for each column found in the provided DataFrame.
              If criteria is not specified, the defaults for each criteria
              is used.
  
      Raises:
          JanitorError: If `strict=True` and at least one of
              `scale`, `direction`, or `threshold` inputs is not a
              dictionary.
          JanitorError: If `scale` is not one of
              `("absolute", "percentage")`.
          JanitorError: If `direction` is not one of
              `("increasing", "decreasing", "any")`.
          JanitorError: If `threshold` is less than `0.0`.
  
      Returns:
          DataFrame that has `flag jump` columns.
  
      <!--
      # noqa: DAR101
      -->
      """
      df = df.copy()
  
      if strict:
          if (
              any(
                  isinstance(arg, dict)
                  for arg in (scale, direction, threshold)
              )
              is False
          ):
              raise JanitorError(
                  "When enacting 'strict=True', 'scale', 'direction', or "
                  + "'threshold' must be a dictionary."
              )
  
          # Only append a flag col for the cols that appear
          # in at least one of the input dicts
          arg_keys = [
              arg.keys()
              for arg in (scale, direction, threshold)
              if isinstance(arg, dict)
          ]
          cols = set(itertools.chain.from_iterable(arg_keys))
  
      else:
          # Append a flag col for each col in the DataFrame
          cols = df.columns
  
      columns_to_add = {}
      for col in sorted(cols):
          # Allow arguments to be a mix of dict and single instances
          s = (
              scale.get(col, "percentage")
              if isinstance(scale, dict)
              else scale
          )
          d = (
              direction.get(col, "any")
              if isinstance(direction, dict)
              else direction
          )
          t = (
              threshold.get(col, 0.0)
              if isinstance(threshold, dict)
              else threshold
          )
  
          columns_to_add[f"{col}_jump_flag"] = _flag_jumps_single_col(
              df, col, scale=s, direction=d, threshold=t
          )
  
      df = df.assign(**columns_to_add)
  
      return df
  
file_path: pyjanitor/janitor/timeseries.py
imports: import itertools
  from typing import Dict, Union
  import pandas
  import pandas_flavor
  from .errors import JanitorError
  from .utils import check
label_desc: Use image node_id 5 for calling a global function with example usage: flag_jumps(df, scale, direction, threshold, strict) and returns: df