Esempio n. 1
0
    def quantile(
        self,
        *,
        qs: Float64Index,
        axis: int = 0,
        transposed: bool = False,
        interpolation="linear",
    ) -> ArrayManager:

        # error: Value of type variable "ArrayLike" of "ensure_block_shape" cannot be
        # "Union[ndarray, ExtensionArray]"
        arrs = [ensure_block_shape(x, 2)
                for x in self.arrays]  # type: ignore[type-var]
        assert axis == 1
        # error: Value of type variable "ArrayLike" of "quantile_compat" cannot be
        # "object"
        new_arrs = [
            quantile_compat(x, qs, interpolation,
                            axis=axis)  # type: ignore[type-var]
            for x in arrs
        ]
        for i, arr in enumerate(new_arrs):
            if arr.ndim == 2:
                assert arr.shape[0] == 1, arr.shape
                new_arrs[i] = arr[0]

        axes = [qs, self._axes[1]]
        return type(self)(new_arrs, axes)
Esempio n. 2
0
    def quantile(
        self,
        *,
        qs: Float64Index,
        axis: int = 0,
        transposed: bool = False,
        interpolation="linear",
    ) -> ArrayManager:

        arrs = [ensure_block_shape(x, 2) for x in self.arrays]
        assert axis == 1
        new_arrs = [quantile_compat(x, qs, interpolation, axis=axis) for x in arrs]
        for i, arr in enumerate(new_arrs):
            if arr.ndim == 2:
                assert arr.shape[0] == 1, arr.shape
                new_arrs[i] = arr[0]

        axes = [qs, self._axes[1]]
        return type(self)(new_arrs, axes)