code: def mirr(values, finance_rate, reinvest_rate):
      """
      Modified internal rate of return.
  
      Parameters
      ----------
      values : array_like
          Cash flows (must contain at least one positive and one negative
          value) or nan is returned.  The first value is considered a sunk
          cost at time zero.
      finance_rate : scalar
          Interest rate paid on the cash flows
      reinvest_rate : scalar
          Interest rate received on the cash flows upon reinvestment
  
      Returns
      -------
      out : float
          Modified internal rate of return
  
      """
      values = np.asarray(values)
      n = values.size
  
      # Without this explicit cast the 1/(n - 1) computation below
      # becomes a float, which causes TypeError when using Decimal
      # values.
      if isinstance(finance_rate, Decimal):
          n = Decimal(n)
  
      pos = values > 0
      neg = values < 0
      if not (pos.any() and neg.any()):
          return np.nan
      numer = np.abs(npv(reinvest_rate, values * pos))
      denom = np.abs(npv(finance_rate, values * neg))
      return (numer / denom) ** (1 / (n - 1)) * (1 + reinvest_rate) - 1
  
imports: from __future__ import division, absolute_import, print_function
  from decimal import Decimal
  import functools
  import numpy
  from numpy.core import overrides
label_desc: Use image node_id 23 for calling a global function with example usage: mirr(values, finance_rate, reinvest_rate) and returns: unknown, np