code: def fill(series):
      if isinstance(series, pd.Series):
          return (
              series.replace([np.inf, -np.inf], np.nan).ffill().bfill()
          )
      elif isinstance(series, np.ndarray):
          return (
              pd.Series(series)
              .replace([np.inf, -np.inf], np.nan)
              .ffill()
              .bfill()
              .values
          )
      else:
          return series
  
file_path: catalyst/catalyst/examples/simple_universe.py
imports: from datetime import timedelta
  import numpy
  import pandas
  from catalyst import run_algorithm
  from catalyst.api import symbols
  from catalyst.exchange.utils.exchange_utils import get_exchange_symbols
label_desc: Use image node_id 5 for calling a global function with example usage: fill(series) and returns: series, pd, series