code: def split_dataset(
      dataset, split: int | float | pd.Series | str, time_axis: str
  ):
      """Split a dataset into a reference and remaining part based on split params.
  
      :param pd.Dataset|pyspark.sql.Dataset dataset: dataset as input
      :param Any split: split details, meaning depends on the type:
          if integer, then the reference will be the first ``split`` instances
          if float, then ``split`` will be used as ration (e.g. 0.5 returns a 50/50 split)
          otherwise, the ``split`` are interpreted as condition, where the records for which the condition is
          true are considered the reference, and the other records the remaining dataset.
      :param time_axis: the time axis
      :return: tuple of reference, dataset
      """
  
      if isinstance(split, int):
          split_type = "n_instances"
          if split <= 0:
              raise ValueError(
                  "Number of instances should be greater than 0"
              )
      elif isinstance(split, float):
          if split >= 1.0 or split <= 0:
              raise ValueError("Fraction should be 0 > fraction > 1")
          split_type = "fraction"
      elif isinstance(split, (pd.Series, str)):
          split_type = "condition"
      else:
          raise TypeError(
              "`split` should be int, float, str or pd.Series"
          )
  
      if isinstance(dataset, pd.DataFrame):
          reference, df = _split_dataset_pandas(
              dataset, split_type, split
          )
      else:
          reference, df = _split_dataset_spark(
              dataset, split_type, split, time_axis
          )
  
      return reference, df
  
imports: from __future__ import annotations
  from math import floor
  import pandas
  from typing_extensions import Literal
label_desc: Use image node_id 3 for calling a global function with example usage: split_dataset(dataset, split, time_axis) and returns: reference,  df