

def _process(self, view, key=None):
    if self.p.dimension:
        selected_dim = self.p.dimension
    else:
        selected_dim = [d.name for d in (view.vdims + view.kdims)][0]
    data = np.array(view.dimension_values(selected_dim))
    if self.p.nonzero:
        mask = (data > 0)
        data = data[mask]
    if self.p.weight_dimension:
        weights = np.array(view.dimension_values(self.p.weight_dimension))
        if self.p.nonzero:
            weights = weights[mask]
    else:
        weights = None
    hist_range = (find_minmax((np.nanmin(data), np.nanmax(data)), (0, (- float('inf')))) if (self.p.bin_range is None) else self.p.bin_range)
    if (hist_range == (0, 0)):
        hist_range = (0, 1)
    data = data[np.invert(np.isnan(data))]
    normed = (False if (self.p.mean_weighted and self.p.weight_dimension) else self.p.normed)
    try:
        (hist, edges) = np.histogram(data[np.isfinite(data)], normed=normed, range=hist_range, weights=weights, bins=self.p.num_bins)
        if ((not normed) and self.p.weight_dimension and self.p.mean_weighted):
            (hist_mean, _) = np.histogram(data[np.isfinite(data)], normed=normed, range=hist_range, bins=self.p.num_bins)
            hist /= hist_mean
    except:
        edges = np.linspace(hist_range[0], hist_range[1], (self.p.num_bins + 1))
        hist = np.zeros(self.p.num_bins)
    hist[np.isnan(hist)] = 0
    params = {
        
    }
    if self.p.weight_dimension:
        params['vdims'] = [view.get_dimension(self.p.weight_dimension)]
    if (view.group != view.__class__.__name__):
        params['group'] = view.group
    hist_view = Histogram(hist, edges, kdims=[view.get_dimension(selected_dim)], label=view.label, **params)
    return ((view << hist_view) if self.p.adjoin else hist_view)

dataset/ETHPy150Open ioam/holoviews/holoviews/operation/element.py histogram._process/original