コード例 #1
0
    def _numeric_quantile(self, q: Union[float, Sequence[float]],
                          interpolation: str, exact: bool) -> NumericalColumn:
        quant = [float(q)] if not isinstance(q, (Sequence, np.ndarray)) else q
        # get sorted indices and exclude nulls
        sorted_indices = self.as_frame()._get_sorted_inds(True, "first")
        sorted_indices = sorted_indices[self.null_count:]

        return cpp_quantile(self, quant, interpolation, sorted_indices, exact)
コード例 #2
0
ファイル: decimal.py プロジェクト: rongou/cudf
    def _decimal_quantile(self, q: Union[float, Sequence[float]],
                          interpolation: str, exact: bool) -> ColumnBase:
        quant = [float(q)] if not isinstance(q, (Sequence, np.ndarray)) else q
        # get sorted indices and exclude nulls
        sorted_indices = self.as_frame()._get_sorted_inds(ascending=True,
                                                          na_position="first")
        sorted_indices = sorted_indices[self.null_count:]

        result = cpp_quantile(self, quant, interpolation, sorted_indices,
                              exact)

        return result._with_type_metadata(self.dtype)
コード例 #3
0
ファイル: numerical.py プロジェクト: gerashegalov/cudf
    def _numeric_quantile(self, q, interpolation, exact):
        is_number = isinstance(q, Number)

        if is_number:
            quant = [float(q)]
        elif isinstance(q, list) or isinstance(q, np.ndarray):
            quant = q
        else:
            msg = "`q` must be either a single element, list or numpy array"
            raise TypeError(msg)

        # get sorted indices and exclude nulls
        sorted_indices = self.as_frame()._get_sorted_inds(True, "first")
        sorted_indices = sorted_indices[self.null_count:]

        return cpp_quantile(self, quant, interpolation, sorted_indices, exact)