pandas-vet


Namepandas-vet JSON
Version 2023.8.2 PyPI version JSON
download
home_pageNone
SummaryA flake8 plugin to lint pandas in an opinionated way.
upload_time2023-08-11 15:09:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords flake8 linter pandas pandas-vet qa
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pandas-vet

`pandas-vet` is a plugin for `flake8` that provides opinionated linting for `pandas` code.

[![Documentation Status](https://readthedocs.org/projects/pandas-vet/badge/?version=stable)](https://pandas-vet.readthedocs.io/en/latest/?badge=stable)

[![Test and lint](https://github.com/deppen8/pandas-vet/actions/workflows/testing.yml/badge.svg)](https://github.com/deppen8/pandas-vet/actions/workflows/testing.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI - License](https://img.shields.io/pypi/l/pandas-vet.svg)](https://github.com/deppen8/pandas-vet/blob/main/LICENSE)

[![PyPI](https://img.shields.io/pypi/v/pandas-vet.svg)](https://pypi.org/project/pandas-vet/)
[![PyPI - Status](https://img.shields.io/pypi/status/pandas-vet.svg)](https://pypi.org/project/pandas-vet/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pandas-vet.svg)](https://pypi.org/project/pandas-vet/)

[![Conda Version](https://img.shields.io/conda/vn/conda-forge/pandas-vet.svg)](https://anaconda.org/conda-forge/pandas-vet)
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandas-vet.svg)](https://anaconda.org/conda-forge/pandas-vet)

## Basic usage

Take the following script, `drop_column.py`, which contains valid pandas code:

```python
# drop_column.py
import pandas

df = pandas.DataFrame({
    'col_a': [i for i in range(20)],
    'col_b': [j for j in range(20, 40)]
})
df.drop(columns='col_b', inplace=True)
```

With `pandas-vet` installed, if we run Flake8 on this script, we will see three warnings raised.

```bash
$ flake8 drop_column.py

./drop_column.py:2:1: PD001 pandas should always be imported as 'import pandas as pd'
./drop_column.py:4:1: PD901 'df' is a bad variable name. Be kinder to your future self.
./drop_column.py:7:1: PD002 'inplace = True' should be avoided; it has inconsistent behavior
```

We can use these to improve the code.

```python
# pandastic_drop_column.py
import pandas as pd

ab_dataset = pd.DataFrame({
    'col_a': [i for i in range(20)],
    'col_b': [j for j in range(20, 40)]
})
a_dataset = ab_dataset.drop(columns='col_b')
```

For a full list, see the [Supported warnings](https://pandas-vet.readthedocs.io/en/stable/guides/warnings.html) page of the documentation.

## Motivation

Starting with [pandas](https://pandas.pydata.org/) can be daunting. The usual internet help sites are littered with different ways to do the same thing and some features that the pandas docs themselves discourage live on in the API. `pandas-vet` is (hopefully) a way to help make pandas a little more friendly for newcomers by taking some opinionated stances about pandas best practices. It is designed to help users reduce the pandas universe.

The idea to create a linter was sparked by [Ania Kapuścińska](https://twitter.com/lambdanis)'s talk at PyCascades 2019, ["Lint your code responsibly!"](https://youtu.be/hAnCiTpxXPg?t=21814). The package was largely developed at the PyCascades 2019 sprints.

Many of the opinions stem from [Ted Petrou's](https://twitter.com/TedPetrou) excellent [Minimally Sufficient Pandas](https://medium.com/dunder-data/minimally-sufficient-pandas-a8e67f2a2428). Other ideas are drawn from pandas docs or elsewhere. The [Pandas in Black and White](https://deppen8.github.io/pandas-bw/) flashcards have a lot of the same opinions too.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pandas-vet",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "flake8,linter,pandas,pandas-vet,qa",
    "author": null,
    "author_email": "Jacob Deppen <deppen.8@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f5/57/2c8350ff48cece1f6009012a0f42413e9e6d5ca54bec7f3b5726b6e33e1b/pandas_vet-2023.8.2.tar.gz",
    "platform": null,
    "description": "# pandas-vet\n\n`pandas-vet` is a plugin for `flake8` that provides opinionated linting for `pandas` code.\n\n[![Documentation Status](https://readthedocs.org/projects/pandas-vet/badge/?version=stable)](https://pandas-vet.readthedocs.io/en/latest/?badge=stable)\n\n[![Test and lint](https://github.com/deppen8/pandas-vet/actions/workflows/testing.yml/badge.svg)](https://github.com/deppen8/pandas-vet/actions/workflows/testing.yml)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![PyPI - License](https://img.shields.io/pypi/l/pandas-vet.svg)](https://github.com/deppen8/pandas-vet/blob/main/LICENSE)\n\n[![PyPI](https://img.shields.io/pypi/v/pandas-vet.svg)](https://pypi.org/project/pandas-vet/)\n[![PyPI - Status](https://img.shields.io/pypi/status/pandas-vet.svg)](https://pypi.org/project/pandas-vet/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pandas-vet.svg)](https://pypi.org/project/pandas-vet/)\n\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/pandas-vet.svg)](https://anaconda.org/conda-forge/pandas-vet)\n[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandas-vet.svg)](https://anaconda.org/conda-forge/pandas-vet)\n\n## Basic usage\n\nTake the following script, `drop_column.py`, which contains valid pandas code:\n\n```python\n# drop_column.py\nimport pandas\n\ndf = pandas.DataFrame({\n    'col_a': [i for i in range(20)],\n    'col_b': [j for j in range(20, 40)]\n})\ndf.drop(columns='col_b', inplace=True)\n```\n\nWith `pandas-vet` installed, if we run Flake8 on this script, we will see three warnings raised.\n\n```bash\n$ flake8 drop_column.py\n\n./drop_column.py:2:1: PD001 pandas should always be imported as 'import pandas as pd'\n./drop_column.py:4:1: PD901 'df' is a bad variable name. Be kinder to your future self.\n./drop_column.py:7:1: PD002 'inplace = True' should be avoided; it has inconsistent behavior\n```\n\nWe can use these to improve the code.\n\n```python\n# pandastic_drop_column.py\nimport pandas as pd\n\nab_dataset = pd.DataFrame({\n    'col_a': [i for i in range(20)],\n    'col_b': [j for j in range(20, 40)]\n})\na_dataset = ab_dataset.drop(columns='col_b')\n```\n\nFor a full list, see the [Supported warnings](https://pandas-vet.readthedocs.io/en/stable/guides/warnings.html) page of the documentation.\n\n## Motivation\n\nStarting with [pandas](https://pandas.pydata.org/) can be daunting. The usual internet help sites are littered with different ways to do the same thing and some features that the pandas docs themselves discourage live on in the API. `pandas-vet` is (hopefully) a way to help make pandas a little more friendly for newcomers by taking some opinionated stances about pandas best practices. It is designed to help users reduce the pandas universe.\n\nThe idea to create a linter was sparked by [Ania Kapu\u015bci\u0144ska](https://twitter.com/lambdanis)'s talk at PyCascades 2019, [\"Lint your code responsibly!\"](https://youtu.be/hAnCiTpxXPg?t=21814). The package was largely developed at the PyCascades 2019 sprints.\n\nMany of the opinions stem from [Ted Petrou's](https://twitter.com/TedPetrou) excellent [Minimally Sufficient Pandas](https://medium.com/dunder-data/minimally-sufficient-pandas-a8e67f2a2428). Other ideas are drawn from pandas docs or elsewhere. The [Pandas in Black and White](https://deppen8.github.io/pandas-bw/) flashcards have a lot of the same opinions too.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A flake8 plugin to lint pandas in an opinionated way.",
    "version": "2023.8.2",
    "project_urls": {
        "Homepage": "https://github.com/deppen8/pandas-vet",
        "Issues": "https://github.com/deppen8/pandas-vet/issues"
    },
    "split_keywords": [
        "flake8",
        "linter",
        "pandas",
        "pandas-vet",
        "qa"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "17dd128ade78c67d4ac1a6202f320112aaa7934eaf8f7b0d861517e7c960dd3f",
                "md5": "1a409ed96788ed2268b91c73d3aefba1",
                "sha256": "761c07b4479f24fc507465047111c7d21374ec678b7aba58e454fd5d3f8055fe"
            },
            "downloads": -1,
            "filename": "pandas_vet-2023.8.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a409ed96788ed2268b91c73d3aefba1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7396,
            "upload_time": "2023-08-11T15:09:04",
            "upload_time_iso_8601": "2023-08-11T15:09:04.842211Z",
            "url": "https://files.pythonhosted.org/packages/17/dd/128ade78c67d4ac1a6202f320112aaa7934eaf8f7b0d861517e7c960dd3f/pandas_vet-2023.8.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f5572c8350ff48cece1f6009012a0f42413e9e6d5ca54bec7f3b5726b6e33e1b",
                "md5": "bcdbfce31b4ed13e7d1a7509b498fd85",
                "sha256": "ee6b80b40f5a74de41c29393e4dce373447b363faaa3e0677e4f36799ea865c3"
            },
            "downloads": -1,
            "filename": "pandas_vet-2023.8.2.tar.gz",
            "has_sig": false,
            "md5_digest": "bcdbfce31b4ed13e7d1a7509b498fd85",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9029,
            "upload_time": "2023-08-11T15:09:03",
            "upload_time_iso_8601": "2023-08-11T15:09:03.945840Z",
            "url": "https://files.pythonhosted.org/packages/f5/57/2c8350ff48cece1f6009012a0f42413e9e6d5ca54bec7f3b5726b6e33e1b/pandas_vet-2023.8.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-11 15:09:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "deppen8",
    "github_project": "pandas-vet",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pandas-vet"
}
        
Elapsed time: 1.81399s