How to use the pdpipe.core.PdPipeline function in pdpipe

To help you get started, weโ€™ve selected a few pdpipe 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 pdpipe / pdpipe / tests / compound / test_attribute_stages.py View on Github external
def test_attribute_stage():
    """Testing attribute pipeline stages."""
    pipeline = pdp.ColDrop('name').Bin({'speed': [5]}, drop=True)
    assert isinstance(pipeline, PdPipeline)
    assert isinstance(pipeline[0], ColDrop)
    assert isinstance(pipeline[1], Bin)
    df = _some_df()
    res_df = pipeline(df)
    assert 'speed' in res_df.columns
    assert 'name' not in res_df.columns
github pdpipe / pdpipe / pdpipe / core.py View on Github external
def __getitem__(self, index):
        if isinstance(index, slice):
            return PdPipeline(self._stages[index])
        return self._stages[index]
github pdpipe / pdpipe / pdpipe / core.py View on Github external
def __add__(self, other):
        if isinstance(other, PdPipeline):
            return PdPipeline([self, *other._stages])
        elif isinstance(other, PdPipelineStage):
            return PdPipeline([self, other])
        else:
            return NotImplemented
github pdpipe / pdpipe / pdpipe / core.py View on Github external
def __add__(self, other):
        if isinstance(other, PdPipeline):
            return PdPipeline([*self._stages, *other._stages])
        elif isinstance(other, PdPipelineStage):
            return PdPipeline([*self._stages, other])
        else:
            return NotImplemented
github pdpipe / pdpipe / pdpipe / core.py View on Github external
def __init__(self, stages, transformer_getter=None, **kwargs):
        self._stages = stages
        self._trans_getter = transformer_getter
        self.is_fitted = False
        super_kwargs = {
            'exraise': False,
            'exmsg': PdPipeline._DEF_EXC_MSG,
            'appmsg': PdPipeline._DEF_APP_MSG
        }
        super_kwargs.update(**kwargs)
        super().__init__(**super_kwargs)
github pdpipe / pdpipe / pdpipe / core.py View on Github external
def __init__(self, stages, transformer_getter=None, **kwargs):
        self._stages = stages
        self._trans_getter = transformer_getter
        self.is_fitted = False
        super_kwargs = {
            'exraise': False,
            'exmsg': PdPipeline._DEF_EXC_MSG,
            'appmsg': PdPipeline._DEF_APP_MSG
        }
        super_kwargs.update(**kwargs)
        super().__init__(**super_kwargs)
github pdpipe / pdpipe / pdpipe / core.py View on Github external
Parameters
    ----------
    *stages : pdpipe.PipelineStage objects
       PdPipeline stages given as positional arguments.

    Returns
    -------
    p : pdpipe.PdPipeline
        The resulting pipeline.

    Examples
    --------
    import pdpipe as pdp
    make_pdpipeline(pdp.ColDrop('a'), pdp.Bin('speed'))
    """
    return PdPipeline(stages=stages)