https://github.com/pdpipe/pdpipe

Easy pipelines for pandas DataFrames.

https://github.com/pdpipe/pdpipe

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.2%) to scientific vocabulary

Keywords

data data-science dataframe dataframes pandas pandas-dataframe pipeline
Last synced: 6 months ago · JSON representation

Repository

Easy pipelines for pandas DataFrames.

Basic Info
Statistics
  • Stars: 720
  • Watchers: 14
  • Forks: 45
  • Open Issues: 17
  • Releases: 49
Topics
data data-science dataframe dataframes pandas pandas-dataframe pipeline
Created about 9 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct

README.rst

pdpipe ˨
########

|PyPI-Status| |Downloads| |PyPI-Versions| |Build-Status| |Codecov| |Codefactor| |CodeStyle| |LICENCE|


Website: `https://pdpipe.readthedocs.io/en/latest/ `_

Easy pipelines for pandas DataFrames (`learn how! `_).

.. code-block:: python

  >>> df = pd.DataFrame(
          data=[[4, 165, 'USA'], [2, 180, 'UK'], [2, 170, 'Greece']],
          index=['Dana', 'Jane', 'Nick'],
          columns=['Medals', 'Height', 'Born']
      )
  >>> import pdpipe as pdp
  >>> pipeline = pdp.ColDrop('Medals').OneHotEncode('Born')
  >>> pipeline(df)
              Height  Born_UK  Born_USA
      Dana     165        0         1
      Jane     180        1         0
      Nick     170        0         0

.. .. alternative symbols: ˨ ᛪ ᛢ ᚶ ᚺ ↬ ⑀ ⤃ ⤳ ⥤ 』

.. contents::

.. section-numbering::

📚 Documentation
================

This is the repository of the ``pdpipe`` package, and this readme file is aimed to help potential contributors to the project.

To learn more about how to use ``pdpipe``, either `visit pdpipe's homepage `_ or read the `getting started section `_.


🔩 Installation
===============

Install ``pdpipe`` with:

.. code-block:: bash

  pip install pdpipe

Some pipeline stages require ``scikit-learn``; they will simply not be loaded if ``scikit-learn`` is not found on the system, and ``pdpipe`` will issue a warning. To use them you must also `install scikit-learn `_.


Similarly, some pipeline stages require ``nltk``; they will simply not be loaded if ``nltk`` is not found on your system, and ``pdpipe`` will issue a warning. To use them you must additionally `install nltk `_.



🎁 Contributing
===============

Package author and current maintainer is `Shay Palachy `_ (shay.palachy@gmail.com); You are more than welcome to approach him for help. Contributions are very welcomed, especially since this package is very much in its infancy and many other pipeline stages can be added.

🪛 Installing for development
-----------------------------

Clone:

.. code-block:: bash

  git clone git@github.com:pdpipe/pdpipe.git


Install in development mode with test dependencies:

.. code-block:: bash

  cd pdpipe
  pip install -e ".[test]"


⚗️ Running the tests
--------------------

To run the tests, use:

.. code-block:: bash

  python -m pytest


Notice ``pytest`` runs are configured by the ``pytest.ini`` file. Read it to understand the exact ``pytest`` arguments used.


🔬 Adding tests
---------------

At the time of writing, ``pdpipe`` is maintained with a test coverage of 100%. Although challenging, I hope to maintain this status. If you add code to the package, please make sure you thoroughly test it. Codecov automatically reports changes in coverage on each PR, and so PR reducing test coverage will not be examined before that is fixed.

Tests reside under the ``tests`` directory in the root of the repository. Each module has a separate test folder, with each class - usually a pipeline stage - having a dedicated file (always starting with the string "test") containing several tests (each a global function starting with the string "test"). Please adhere to this structure, and try to separate tests cases to different test functions; this allows us to quickly focus on problem areas and use cases. Thank you! :)


⚙️ Configuration
----------------

``pdpipe`` can be configured using both a configuration file - locaated at either ``$XDG_CONFIG_HOME/pdpipe/cfg.json`` or, if the ``XDG_CONFIG_HOME`` environment variable is not set, at ``~/.pdpipe/cfg.json`` - and environment variables.

At the moment, these configuration options are only relevant for development. The available options are:

* ``LOAD_STAGE_ATTRIBUTES`` - True by default. If set to False stage attributes, which enable the chainer construction pattern, e.g. ``pdp.ColDrop('b').Bin('f')``, are not loaded. This is used for sensible documentation generation. Set with this ``"LOAD_STAGE_ATTRIBUTES": false`` in ``cfg.json``, or with ``export PDPIPE__LOAD_STAGE_ATTRIBUTES=False`` for environment variable-driven configuration.


✒️ Code style
-------------

``pdpip`` code is written to adhere to the coding style dictated by `flake8 `_. Practically, this means that one of the jobs that runs on `the project's Travis `_ for each commit and pull request checks for a successfull run of the ``flake8`` CLI command in the repository's root. Which means pull requests will be flagged red by the Travis bot if non-flake8-compliant code was added.

To solve this, please run ``flake8`` on your code (whether through your text editor/IDE or using the command line) and fix all resulting errors. Thank you! :)


📓 Adding documentation
-----------------------

This project is documented using the `numpy docstring conventions`_, which were chosen as they are perhaps the most widely-spread conventions that are both supported by common tools such as Sphinx and result in human-readable docstrings (in my personal opinion, of course). When documenting code you add to this project, please follow `these conventions`_.

.. _`numpy docstring conventions`: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard
.. _`these conventions`: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard

Additionally, if you update this ``README.rst`` file,  use ``python setup.py checkdocs`` to validate it compiles.


📋 Adding doctests
------------------

Doctests can be added in the traditional manner:

.. code-block:: python


    class ApplyByCols(PdPipelineStage):
        """A pipeline stage applying an element-wise function to columns.

        Parameters
        ----------
        columns : str or list-like
            Names of columns on which to apply the given function.
        func : function
            The function to be applied to each element of the given columns.
        result_columns : str or list-like, default None
            The names of the new columns resulting from the mapping operation. Must
            be of the same length as columns. If None, behavior depends on the
            drop parameter: If drop is True, the name of the source column is used;
            otherwise, the name of the source column is used with the suffix
            '_app'.
        drop : bool, default True
            If set to True, source columns are dropped after being mapped.
        func_desc : str, default None
            A function description of the given function; e.g. 'normalizing revenue
            by company size'. A default description is used if None is given.


        Example
        -------
        >>> import pandas as pd; import pdpipe as pdp; import math;
        >>> data = [[3.2, "acd"], [7.2, "alk"], [12.1, "alk"]]
        >>> df = pd.DataFrame(data, [1,2,3], ["ph","lbl"])
        >>> round_ph = pdp.ApplyByCols("ph", math.ceil)
        >>> round_ph(df)
           ph  lbl
        1   4  acd
        2   8  alk
        3  13  alk
        """


💳 Credits
==========
Created by `Shay Palachy `_  (shay.palachy@gmail.com).

⭐ Feature Contributors:
------------------------

* `Amihai Offenbacher @amihaiOff `_ - Runtime parameters.

* `David Katz @DavidKatz-il `_ - Black formatter GitHub action.

🐞 Bugfixes & Documentation:
----------------------------

* `@carbonleakage `_

* `@yarkhinephyo `_

* `@Silun `_

* `@naveenkaushik2504 `_

.. alternative:
.. https://badge.fury.io/py/yellowbrick.svg

.. |PyPI-Status| image:: https://img.shields.io/pypi/v/pdpipe.svg
  :target: https://pypi.org/project/pdpipe

.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/pdpipe.svg
   :target: https://pypi.org/project/pdpipe

.. |Build-Status| image:: https://github.com/pdpipe/pdpipe/actions/workflows/test.yml/badge.svg
  :target: https://github.com/pdpipe/pdpipe/actions/workflows/test.yml

.. |LICENCE| image:: https://img.shields.io/badge/License-MIT-ff69b4.svg
  :target: https://pypi.python.org/pypi/pdpipe

.. .. |LICENCE| image:: https://github.com/shaypal5/pdpipe/blob/master/mit_license_badge.svg
  :target: https://pypi.python.org/pypi/pdpipe

.. https://img.shields.io/pypi/l/pdpipe.svg

.. |Codecov| image:: https://codecov.io/github/pdpipe/pdpipe/coverage.svg?branch=master
   :target: https://codecov.io/github/pdpipe/pdpipe?branch=master


.. |Codacy|  image:: https://api.codacy.com/project/badge/Grade/7d605e063f114ecdb5569266bd0226cd
   :alt: Codacy Badge
   :target: https://app.codacy.com/app/shaypal5/pdpipe?utm_source=github.com&utm_medium=referral&utm_content=shaypal5/pdpipe&utm_campaign=Badge_Grade_Dashboard

.. |Requirements| image:: https://requires.io/github/shaypal5/pdpipe/requirements.svg?branch=master
     :target: https://requires.io/github/shaypal5/pdpipe/requirements/?branch=master
     :alt: Requirements Status

.. |Downloads| image:: https://pepy.tech/badge/pdpipe
     :target: https://pepy.tech/project/pdpipe
     :alt: PePy stats

.. |Codefactor| image:: https://www.codefactor.io/repository/github/pdpipe/pdpipe/badge?style=plastic
     :target: https://www.codefactor.io/repository/github/pdpipe/pdpipe
     :alt: Codefactor code quality

.. |CodeStyle| image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
     :alt: Black code style code

Owner

  • Name: pdpipe
  • Login: pdpipe
  • Kind: organization

Easy pipelines for pandas DataFrames.

GitHub Events

Total
  • Release event: 2
  • Watch event: 8
  • Delete event: 4
  • Issue comment event: 11
  • Push event: 44
  • Pull request review comment event: 4
  • Pull request review event: 8
  • Pull request event: 15
  • Create event: 6
Last Year
  • Release event: 2
  • Watch event: 8
  • Delete event: 4
  • Issue comment event: 11
  • Push event: 44
  • Pull request review comment event: 4
  • Pull request review event: 8
  • Pull request event: 15
  • Create event: 6

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 421
  • Total Committers: 11
  • Avg Commits per committer: 38.273
  • Development Distribution Score (DDS): 0.216
Past Year
  • Commits: 15
  • Committers: 1
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Shay Palachy s****5@g****m 330
ShayPalachy s****y@z****o 48
Delirious Lettuce d****e@g****m 21
David Katz 4****l 11
yarkhinephyo y****o@g****m 3
Naveen Kaushik n****4@g****m 3
The Codacy Badger b****r@c****m 1
carbonleakage c****e@o****m 1
amihai a****r@v****i 1
Silun z****g@b****e 1
Shay Palachy s****y@S****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 53
  • Total pull requests: 63
  • Average time to close issues: 3 months
  • Average time to close pull requests: 1 day
  • Total issue authors: 28
  • Total pull request authors: 12
  • Average comments per issue: 2.85
  • Average comments per pull request: 1.13
  • Merged pull requests: 57
  • Bot issues: 0
  • Bot pull requests: 3
Past Year
  • Issues: 0
  • Pull requests: 15
  • Average time to close issues: N/A
  • Average time to close pull requests: about 17 hours
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.2
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • shaypal5 (18)
  • yarkhinephyo (3)
  • vecorro (2)
  • marcglobality (2)
  • banduoba (2)
  • gandad (2)
  • lim-0 (2)
  • MagBuchSB1 (2)
  • shinokada (1)
  • Devligue (1)
  • milesgranger (1)
  • jjlee88 (1)
  • easimadi (1)
  • daf (1)
  • altescy (1)
Pull Request Authors
  • shaypal5 (45)
  • DavidKatz-il (3)
  • dependabot[bot] (3)
  • yarkhinephyo (3)
  • Asrst (2)
  • Silun (1)
  • codacy-badger (1)
  • amihaiOff (1)
  • kernc (1)
  • naveenkaushik2504 (1)
  • carbonleakage (1)
  • delirious-lettuce (1)
Top Labels
Issue Labels
enhancement (26) good first issue (13) complex issue (11) bug (10) question (8) invalid (7) help wanted (6) documentation (5) chore (2) tests (1) wontfix (1)
Pull Request Labels
enhancement (15) bugfix (8) ci/cd (6) tests (5) good first issue (3) chore (2) CI (2) bug (1) github_actions (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 1,531 last-month
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 12
    (may contain duplicates)
  • Total versions: 108
  • Total maintainers: 1
pypi.org: pdpipe

Easy pipelines for pandas.

  • Documentation: https://pdpipe.readthedocs.io/
  • License: MIT License Copyright (c) 2017 Shay Palachy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 1.1.0
    published 8 months ago
  • Versions: 88
  • Dependent Packages: 1
  • Dependent Repositories: 12
  • Downloads: 1,531 Last month
Rankings
Dependent repos count: 4.2%
Downloads: 5.8%
Average: 6.7%
Dependent packages count: 10.1%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: pdpipe

Ever written a preprocessing pipeline for pandas dataframes and had trouble serializing it for later depoloyment on a different machine? Ever needed fit-able preprocessing transformations, that have tunable paramaters that are inferred from training data, to be used later to transform input data? Ever struggled with preprocessing different types of data in the same pandas dataframe? Enter pdpipe, a simple framework for serializable, chainable and verbose pandas pipelines. Its intuitive API enables you to generate, using only a few lines, complex pandas processing pipelines that can easily be broken down or composed together, examined and debugged, and that adhere to scikit-learn's Transformer API. Stop writing the same preprocessing boilerplate code again and again!

  • Versions: 20
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 13.8%
Forks count: 24.0%
Average: 30.8%
Dependent repos count: 34.0%
Dependent packages count: 51.2%
Last synced: 6 months ago

Dependencies

docs/mkdocs/requirements.txt pypi
  • GitPython *
  • mkdocs-awesome-pages-plugin *
  • mkdocs-git-revision-date-plugin *
  • mkdocs-jupyter ==0.19.0
  • mkdocs-material ==8.3.9
  • mkdocstrings >=0.18
  • nltk *
  • python-markdown-math ==0.8
  • pytkdocs >=0.5.0
  • scikit-learn *
.github/workflows/black.yml actions
  • actions/checkout v2.5.0 composite
  • psf/black stable composite
.github/workflows/checkdocs.yml actions
  • actions/checkout v2.5.0 composite
  • actions/setup-python v4.3.0 composite
.github/workflows/lint.yml actions
  • actions/checkout v2.5.0 composite
  • actions/setup-python v4.3.0 composite
  • wearerequired/lint-action v2.1.0 composite
.github/workflows/npdocval.yml actions
  • actions/checkout v2.5.0 composite
  • actions/setup-python v4.3.0 composite
.github/workflows/test.yml actions
  • actions/checkout v2.5.0 composite
  • actions/setup-python v4.3.0 composite
pyproject.toml pypi
setup.py pypi