code: def geometric_mean(returns: pd.Series) -> float:
      returns = returns.fillna(0) + 1
      if np.any(returns <= 0):
          return 0
      return (
          np.exp(np.log(returns).sum() / (len(returns) or np.nan)) - 1
      )
  
file_path: backtesting.py/backtesting/_stats.py
imports: from typing import TYPE_CHECKING, List, Union
  import numpy
  import pandas
  from ._util import _data_period
label_desc: Use image node_id 2 for calling a global function with example usage: geometric_mean(returns) and returns: unknown, int