code: def calc_inv_vol_weights(returns):
      
      # calc vols
      vol = np.divide(1., np.std(returns, ddof=1))
      vol[np.isinf(vol)] = np.NaN
      volsum = vol.sum()
      return np.divide(vol, volsum)
docs: Calculates weights proportional to inverse volatility of each column.
  
      Returns weights that are inversely proportional to the column's
      volatility resulting in a set of portfolio weights where each position
      has the same level of volatility.
  
      Note, that assets with returns all equal to NaN or 0 are excluded from
      the portfolio (their weight is set to NaN).
  
      Returns:
          Series {col_name: weight}