How to use the dask.utils.derived_from function in dask

To help you get started, we’ve selected a few dask examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dask / dask / dask / dataframe / tseries / resample.py View on Github external
    @derived_from(pd_Resampler)
    def max(self):
        return self._agg("max")
github dask / dask / dask / dataframe / groupby.py View on Github external
    @derived_from(pd.core.groupby.SeriesGroupBy)
    def unique(self, split_every=None, split_out=1):
        name = self._meta.obj.name
        return self._aca_agg(
            token="unique",
            func=M.unique,
            aggfunc=_unique_aggregate,
            aggregate_kwargs={"name": name},
            split_every=split_every,
            split_out=split_out,
        )
github dask / dask / dask / array / ufunc.py View on Github external
if len(dsk) > 0:
            is_dataframe = (
                is_dataframe_like(dsk[0])
                or is_series_like(dsk[0])
                or is_index_like(dsk[0])
            )
            if array_wrap and (is_dataframe or not IS_NEP18_ACTIVE):
                return dsk[0]._elemwise(__array_wrap__, numpy_ufunc, *args, **kwargs)
            else:
                return dsk[0]._elemwise(numpy_ufunc, *args, **kwargs)
        else:
            return numpy_ufunc(*args, **kwargs)

    # functools.wraps cannot wrap ufunc in Python 2.x
    wrapped.__name__ = numpy_ufunc.__name__
    return derived_from(source)(wrapped)
github dask / dask / dask / dataframe / core.py View on Github external
    @derived_from(pd.Series)
    def cov(self, other, min_periods=None, split_every=False):
        from .multi import concat
        if not isinstance(other, Series):
            raise TypeError("other must be a dask.dataframe.Series")
        df = concat([self, other], axis=1)
        return cov_corr(df, min_periods, scalar=True, split_every=split_every)
github dask / dask-ml / dask_ml / model_selection / _search.py View on Github external
    @derived_from(BaseSearchCV)
    def score(self, X, y=None):
        if self.scorer_ is None:
            raise ValueError(
                "No score function explicitly defined, "
                "and the estimator doesn't provide one %s" % self.best_estimator_
            )
        return self.scorer_(self.best_estimator_, X, y)
github dask / dask / dask / dataframe / tseries / resample.py View on Github external
    @derived_from(pd_Resampler)
    def count(self):
        return self._agg("count", fill_value=0)
github dask / dask-ml / dklearn / model_selection.py View on Github external
    @derived_from(BaseSearchCV)
    def predict_proba(self, X):
        self._check_is_fitted('predict_proba')
        return self.best_estimator_.predict_proba(X)
github dask / dask / dask / array / core.py View on Github external
    @derived_from(np.ndarray)
    def max(self, axis=None, keepdims=False, split_every=None, out=None):
        from .reductions import max
        return max(self, axis=axis, keepdims=keepdims, split_every=split_every,
                   out=out)
github dask / dask / dask / array / core.py View on Github external
    @derived_from(np.ndarray)
    def choose(self, choices):
        from .routines import choose
        return choose(self, choices)
github dask / dask / dask / dataframe / accessor.py View on Github external
    @derived_from(pd.core.strings.StringMethods)
    def cat(self, others=None, sep=None, na_rep=None):
        from .core import Series, Index

        if others is None:
            raise NotImplementedError("x.str.cat() with `others == None`")

        valid_types = (Series, Index, pd.Series, pd.Index)
        if isinstance(others, valid_types):
            others = [others]
        elif not all(isinstance(a, valid_types) for a in others):
            raise TypeError("others must be Series/Index")

        return self._series.map_partitions(
            str_cat, *others, sep=sep, na_rep=na_rep, meta=self._series._meta
        )