code: def wmean_and_var_str_array(W, x): 
      
      m = np.empty(shape=x.shape[1:], dtype=x.dtype)
      v = np.empty_like(m)
      for p in x.dtype.names:
          m[p], v[p] = wmean_and_var(W, x[p]).values()
      return {'mean': m, 'var': v}
docs: Weighted mean and variance of each component of a structured array.
  
      Parameters
      ----------
      W: (N,) ndarray
          normalised weights (must be >=0 and sum to one). 
      x: (N,) structured array
          data 
  
      Returns
      -------
      dictionary 
          {'mean':weighted_means, 'var':weighted_variances}