code: def cum_returns(returns, starting_value=0):
      """
      Compute cumulative returns from simple returns.
  
      Parameters
      ----------
      returns : pd.Series or np.ndarray
          Returns of the strategy as a percentage, noncumulative.
           - Time series with decimal returns.
           - Example:
              2015-07-16    -0.012143
              2015-07-17    0.045350
              2015-07-20    0.030957
              2015-07-21    0.004902.
      starting_value : float, optional
         The starting returns.
  
      Returns
      -------
      pd.Series or np.ndarray
          Series of cumulative returns.
  
      Notes
      -----
      For increased numerical accuracy, convert input to log returns
      where it is possible to sum instead of multiplying.
      PI((1+r_i)) - 1 = exp(ln(PI(1+r_i)))     # x = exp(ln(x))
                      = exp(SIGMA(ln(1+r_i))   # ln(a*b) = ln(a) + ln(b)
      """
      # df_price.pct_change() adds a nan in first position, we can use
      # that to have cum_logarithmic_returns start at the origin so that
      # df_cum.iloc[0] == starting_value
      # Note that we can't add that ourselves as we don't know which dt
      # to use.
  
      if len(returns) < 1:
          return type(returns)([])
  
      if np.any(np.isnan(returns)):
          returns = returns.copy()
          returns[np.isnan(returns)] = 0.0
  
      df_cum = (returns + 1).cumprod(axis=0)
  
      if starting_value == 0:
          return df_cum - 1
      else:
          return df_cum * starting_value
  
imports: from __future__ import division
  from functools import wraps
  import pandas
  import numpy
  from scipy import stats
  from six import iteritems
  from empyrical.utils import nanmean, nanstd, nanmin
label_desc: Use image node_id 3 for calling a global function with example usage: cum_returns(returns, starting_value) and returns: type, unknown, unknown