code: def series_to_list(series: Series) -> list[Any]:
      """
      Converts a `Series` to a regular list, and replaces non-numeric values to
      Nones.
  
      :param series: Series to convert
      :return: list without nan or inf
      """
      return [
          None
          if not isinstance(val, str)
          and (math.isnan(val) or math.isinf(val))
          else val
          for val in series.tolist()
      ]
  
imports: import math
  from typing import Any, Optional
  from pandas import Series
label_desc: Use image node_id 1 for calling a global function with example usage: series_to_list(series) and returns: unknown