code: def confidence_interval(data, conf=0.95):
      r
      if conf < 0 or conf > 1:
          raise ValueError('Not a meaningful confidence level: '+str(conf))
  
      try:
          data = types.ensure_ndarray(data, kind='numeric')
      except:
          # if 1D array of arrays try to fuse it
          if isinstance(data, np.ndarray) and np.ndim(data) == 1:
              newshape = tuple([len(data)] + list(data[0].shape))
              newdata = np.zeros(newshape)
              for i in range(len(data)):
                  newdata[i, :] = data[i]
              data = newdata
  
      types.assert_array(data, kind='numeric')
  
      if np.ndim(data) == 1:
          m, lower, upper = _confidence_interval_1d(data, conf)
          return lower, upper
      else:
          I = _indexes(data[0])
          lower = np.zeros(data[0].shape)
          upper = np.zeros(data[0].shape)
          for i in I:
              col = _column(data, i)
              m, lower[i], upper[i] = _confidence_interval_1d(col, conf)
          # return
          return lower, upper
docs: r""" Computes element-wise confidence intervals from a sample of ndarrays
  
      Given a sample of arbitrarily shaped ndarrays, computes element-wise
      confidence intervals
  
      Parameters
      ----------
      data : array-like of dimension 1 to 3
          array of numbers or arrays. The first index is used as the sample
          index, the remaining indexes are specific to the array of interest
      conf : float, optional, default = 0.95
          confidence interval
  
      Return
      ------
      lower : ndarray(shape)
          element-wise lower bounds
      upper : ndarray(shape)
          element-wise upper bounds