{"id":28255228,"url":"https://github.com/eikevons/pandas-paddles","last_synced_at":"2025-06-16T06:31:27.186Z","repository":{"id":42446189,"uuid":"355422675","full_name":"eikevons/pandas-paddles","owner":"eikevons","description":"Access the parent Pandas data frame in loc[], iloc[], assign(), and others Pandas helpers","archived":false,"fork":false,"pushed_at":"2024-07-01T21:23:50.000Z","size":346,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-19T21:13:33.470Z","etag":null,"topics":["data-analysis","data-exploration","data-science","pandas","pandas-dataframe","pandas-library","pandas-loc"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eikevons.png","metadata":{"files":{"readme":"README.rst","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-07T05:27:34.000Z","updated_at":"2024-06-30T12:57:04.000Z","dependencies_parsed_at":"2024-06-29T21:22:21.211Z","dependency_job_id":"28cc437d-931f-44c7-8d6c-fc50e116c824","html_url":"https://github.com/eikevons/pandas-paddles","commit_stats":{"total_commits":93,"total_committers":4,"mean_commits":23.25,"dds":"0.32258064516129037","last_synced_commit":"c64ec141aeaa814e00ec3478dc350d264894d6cb"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/eikevons/pandas-paddles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikevons%2Fpandas-paddles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikevons%2Fpandas-paddles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikevons%2Fpandas-paddles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikevons%2Fpandas-paddles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eikevons","download_url":"https://codeload.github.com/eikevons/pandas-paddles/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikevons%2Fpandas-paddles/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260114293,"owners_count":22960871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","data-exploration","data-science","pandas","pandas-dataframe","pandas-library","pandas-loc"],"created_at":"2025-05-19T21:13:21.659Z","updated_at":"2025-06-16T06:31:27.150Z","avatar_url":"https://github.com/eikevons.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Pandas Paddles\n==============\n\n.. image:: docs/source/_static/paddles-logo-small.png\n   :alt: pandas-paddles logo\n   :align: center\n\nAccess the calling ``pandas`` data frame in ``loc[]``, ``iloc[]``,\n``assign()`` and other methods with ``DF`` to write better chains of\ndata frame operations, e.g.:\n\n.. code-block:: python\n\n    df = (\n        df\n        # Select all rows with column \"x\" \u003c 2\n        .loc[DF[\"x\"] \u003c 2]\n        .assign(\n            # Shift \"x\" by its minimum.\n            y = DF[\"x\"] - DF[\"x\"].min(),\n            # Clip \"x\" to it's central 50% window. Note how DF is used\n            # in the argument to `clip()`.\n            z = DF[\"x\"].clip(\n                lower=DF[\"x\"].quantile(0.25),\n                upper=DF[\"x\"].quantile(0.75)\n            ),\n        )\n    )\n\n.. image:: https://readthedocs.org/projects/pandas-paddles/badge/?version=latest\n  :target: https://pandas-paddles.readthedocs.io/en/latest/?badge=latest\n  :alt: Documentation Status\n.. image:: https://github.com/eikevons/pandas-paddles/actions/workflows/check.yml/badge.svg\n  :target: https://github.com/eikevons/pandas-paddles/actions/workflows/check.yml\n  :alt: Test Status\n.. image:: https://img.shields.io/pypi/v/pandas-paddles\n   :target: https://pypi.org/project/pandas-paddles/\n   :alt: Latest version\n.. image:: https://img.shields.io/pypi/pyversions/pandas-paddles\n   :target: https://pypi.org/project/pandas-paddles/\n   :alt: Supported Python versions\n.. image:: https://img.shields.io/pypi/dm/pandas-paddles\n   :target: https://pypi.org/project/pandas-paddles/\n   :alt: PyPI downloads\n\nOverview\n--------\n\n- **Motivation**: Make chaining Pandas operations easier and bring\n  functionality to Pandas similar to Spark's `col()\n  \u003chttps://spark.apache.org/docs/latest/api/python/reference/api/pyspark.sql.functions.col.html#pyspark.sql.functions.col\u003e`_\n  function or referencing columns in R's `dplyr\n  \u003chttps://dplyr.tidyverse.org/articles/dplyr.html\u003e`_.\n- **Install** from PyPI with ``pip install\n  pandas-paddles``. Pandas versions 1+ (``\u003e=1,\u003c3``) are supported.\n- **Documentation** can be found at `readthedocs\n  \u003chttps://pandas-paddles.readthedocs.io/en/latest/\u003e`_.\n- **Source code** can be obtained from `GitHub \u003chttps://github.com/eikevons/pandas-paddles\u003e`_.\n- `Changelog \u003cChangelog.md\u003e`_\n\nExample: Create new column and filter\n-------------------------------------\n\nInstead of writing \"traditional\" Pandas like this:\n\n.. code-block:: python\n\n    df_in = pd.DataFrame({\"x\": range(5)})\n    df = df_in.copy()\n    df[\"y\"] = df[\"x\"] // 2\n    df = df.loc[df[\"y\"] \u003c= 1]\n    df\n    #    x  y\n    # 0  0  0\n    # 1  1  0\n    # 2  2  1\n    # 3  3  1\n\nOne can write:\n\n.. code-block:: python\n\n    from pandas_paddles import DF\n    df = (\n      df_in\n      .assign(y = DF[\"x\"] // 2)\n      .loc[DF[\"y\"] \u003c= 1]\n    )\n\nThis is especially handy when re-iterating on data frame manipulations\ninteractively, e.g. in a notebook (just imagine you have to rename\n``df`` to ``df_out``).\n\nBut you can access all methods and attributes of the data frame from the\ncontext:\n\n.. code-block:: python\n\n    df = pd.DataFrame({\n        \"X\": range(5),\n        \"y\": [\"1\", \"a\", \"c\", \"D\", \"e\"],\n    })\n    df.loc[DF[\"y\"].str.isupper() | DF[\"y\"].str.isnumeric()]\n    #    X  y\n    # 0  0  1\n    # 3  3  D\n    df.loc[:, DF.columns.str.isupper()]\n    #    X\n    # 0  0\n    # 1  1\n    # 2  2\n    # 3  3\n    # 4  4\n\nYou can even use ``DF`` in the arguments to methods:\n\n.. code-block:: python\n\n    df = pd.DataFrame({\n        \"x\": range(5),\n        \"y\": range(2, 7),\n    })\n    df.assign(z = DF['x'].clip(lower=2.2, upper=DF['y'].median()))\n    #    x  y    z\n    # 0  0  2  2.2\n    # 1  1  3  2.2\n    # 2  2  4  2.2\n    # 3  3  5  3.0\n    # 4  4  6  4.0\n\nWhen working with ``pd.Series`` the ``S`` object exists. It can be used\nsimilar to ``DF``:\n\n.. code-block:: python\n\n  s = pd.Series(range(5))\n  s[S \u003c 3]\n  # 0    0\n  # 1    1\n  # 2    2\n  # dtype: int64\n\nSimilar projects for pandas\n===========================\n\n* `siuba \u003chttps://github.com/machow/siuba\u003e`_\n\n  * (+) active\n  * (-) new API to learn\n\n* `pandas-ply \u003chttps://github.com/coursera/pandas-ply\u003e`_\n\n  * (-) stale(?), last change 6 years ago\n  * (-) new API to learn\n  * (-) ``Symbol`` / ``pandas_ply.X`` works only with ``ply_*`` functions\n\n* `pandas-select \u003chttps://pandas-select.readthedocs.io/en/latest/reference/label_selection.html\u003e`_\n\n  * (+) no explicite ``df`` necessary\n  * (-) new API to learn\n\n* `pandas-selectable \u003chttps://github.com/jseabold/pandas-selectable\u003e`_\n\n  * (+) simple ``select`` accessor\n  * (-) usage inside chains clumsy (needs explicite ``df``):\n\n    .. code-block:: python\n\n       ((df\n         .select.A == 'a')\n         .select.B == 'b'\n       )\n\n  * (-) hard-coded ``str``, ``dt`` accessor methods\n  * (?) composable?\n\nDevelopment\n===========\n\nDevelopment is containerized with `Docker \u003chttps://www.docker.com/\u003e`_ to\nseparte from host systems and improve reproducability. No other\nprerequisites are needed on the host system.\n\n**Recommendation for Windows users:** install `WSL 2\n\u003chttps://docs.microsoft.com/en-us/windows/wsl/install-win10\u003e`_ (tested\non Ubuntu 20.04), and for containerized workflows, `Docker\nDesktop \u003chttps://www.docker.com/products/docker-desktop\u003e`_ for Windows.\n\nThe **common tasks** are collected in ``Makefile`` (See ``make help`` for a\ncomplete list):\n\n- Run the unit tests: ``make test`` or ``make watch`` for continuously running\n  tests on code-changes.\n- Build the documentation: ``make docs``\n- **TODO**: Update the ``poetry.lock`` file: ``make lock``\n- Add a dependency:\n\n  1. Start a shell in a new container.\n  2. Add dependency with ``poetry add`` in the running container. This will update\n     ``poetry.lock`` automatically::\n\n        # 1. On the host system\n        % make shell\n        # 2. In the container instance:\n        I have no name!@7d0e85b3a303:/app$ poetry add --dev --lock falcon\n\n- Build the development image ``make image``\n  (Note: This should be done automatically for the targets.) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feikevons%2Fpandas-paddles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feikevons%2Fpandas-paddles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feikevons%2Fpandas-paddles/lists"}