{"id":8397,"library":"pandas-vet","title":"pandas-vet","description":"pandas-vet is a flake8 plugin that provides opinionated linting for pandas code. It helps enforce best practices and reduce common footguns when working with pandas DataFrames and Series by flagging problematic patterns and encouraging more robust and readable code. It is actively maintained and currently at version 2023.8.2, with a regular release cadence.","status":"active","version":"2023.8.2","language":"python","source_language":"en","source_url":"https://github.com/deppen8/pandas-vet","tags":["linting","flake8-plugin","pandas","code-quality","best-practices"],"install":[{"cmd":"pip install pandas-vet","lang":"bash","label":"Install with pip"},{"cmd":"conda install -c conda-forge pandas-vet","lang":"bash","label":"Install with conda"}],"dependencies":[{"reason":"pandas-vet is a plugin for flake8 and requires it to run. If flake8 is not installed, it will be installed automatically with pandas-vet.","package":"flake8","optional":false}],"imports":[{"note":"pandas-vet is a flake8 plugin and works by being installed in the same environment as flake8. You do not import it directly into your Python scripts.","symbol":"pandas-vet as a flake8 plugin","correct":"No direct import needed in user code; flake8 automatically discovers installed plugins."}],"quickstart":{"code":"# my_pandas_script.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})\n\ndf.drop(columns='col_b', inplace=True)\n\n# Run flake8 from your terminal in the same directory\n# flake8 my_pandas_script.py\n\n# Expected output (may vary slightly based on flake8 version):\n# my_pandas_script.py:2:1: PD001 pandas should always be imported as 'import pandas as pd'\n# my_pandas_script.py:4:1: PD901 'df' is a bad variable name. Be kinder to your future self.\n# my_pandas_script.py:7:1: PD002 'inplace = True' should be avoided; it has inconsistent behavior.","lang":"python","description":"After installing `pandas-vet`, it automatically integrates with `flake8`. To use it, simply run `flake8` on your Python files. The example demonstrates common `pandas-vet` warnings (PD001, PD901, PD002) when run against a sample script."},"warnings":[{"fix":"Rewrite operations to return a new DataFrame/Series instead of modifying in-place. For example, `df = df.drop(columns='col_b')` instead of `df.drop(columns='col_b', inplace=True)`.","message":"Using `inplace=True` is strongly discouraged by pandas-vet (PD002) and increasingly by the pandas core team. It can lead to inconsistent behavior, prevent method chaining, and doesn't always provide performance benefits.","severity":"breaking","affected_versions":"All versions of pandas, pandas-vet v0.1.0+"},{"fix":"Use `.to_numpy()` for a NumPy array or `.array` for a pandas ExtensionArray to explicitly state the desired return type. Example: `df.to_numpy()` instead of `df.values`.","message":"Accessing the underlying NumPy array using the `.values` attribute (PD011) is ambiguous and deprecated in pandas.","severity":"deprecated","affected_versions":"pandas-vet v0.2.0+"},{"fix":"Always use `import pandas as pd`. For DataFrames, use more descriptive variable names than `df`. If you disagree with `PD901`, it can be disabled by passing `--ignore PD901` to flake8 or by configuring your flake8 settings.","message":"pandas-vet enforces opinionated import styles and variable names. For example, not importing pandas as `import pandas as pd` (PD001) or naming a DataFrame `df` (PD901) will trigger warnings.","severity":"gotcha","affected_versions":"PD001: pandas-vet v0.1.0+; PD901: pandas-vet v0.2.0+"},{"fix":"Use `.isna`, `.notna`, `.loc` or `.iloc`, `.pivot_table`, `.read_csv`, and `.melt` respectively.","message":"Older methods like `.isnull` (PD003), `.notnull` (PD004), `.ix` (PD007), `.pivot` or `.unstack` (PD010), `.read_table` (PD012), and `.stack` (PD013) are flagged by pandas-vet in favor of their more explicit or recommended counterparts.","severity":"deprecated","affected_versions":"pandas-vet v0.1.0+, v0.2.0+"}],"env_vars":null,"search_vec":"'2023.8.2':53 'activ':47 'best':21,68 'best-practic':67 'cadenc':58 'code':17,44,65 'code-qu':64 'common':25 'current':50 'datafram':31 'encourag':39 'enforc':20 'flag':35 'flake8':9,61 'flake8-plugin':60 'footgun':26 'help':19 'lint':14,59 'maintain':48 'opinion':13 'panda':2,5,16,30,63 'pandas-vet':1,4 'pattern':37 'plugin':10,62 'practic':22,69 'problemat':36 'provid':12 'qualiti':66 'readabl':43 'reduc':24 'regular':56 'releas':57 'robust':41 'seri':33 'version':52 'vet':3,6 'work':28","created_at":"2026-04-16T17:01:58.578053+00:00","updated_at":"2026-04-16T17:01:58.578053+00:00","problems":{"verify_error":"no import statement found"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2023.8.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/deppen8/pandas-vet","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pandas-vet/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"skip","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}