code: def get_max_drawdown_from_series(r):
      """Risk Analysis from asset value
  
      cumprod way
  
      Parameters
      ----------
      r : pandas.Series
          daily return series
      """
      # mdd = ((r.cumsum() - r.cumsum().cummax()) / (1 + r.cumsum().cummax())).min()
  
      mdd = (
          ((1 + r).cumprod() - (1 + r).cumprod().cummax())
          / ((1 + r).cumprod().cummax())
      ).min()
  
      return mdd
  
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  import pandas
  from scipy.stats import spearmanr, pearsonr
  from ..data import D
  from collections import OrderedDict
label_desc: Use image node_id 8 for calling a global function with example usage: get_max_drawdown_from_series(r) and returns: mdd