Registry / data / pyjanitor

pyjanitor

JSON →
library0.32.23pypypi✓ verified 87d ago

pyjanitor is a Python library that extends pandas DataFrames with a clean, user-friendly API for data cleaning and preprocessing. Inspired by the R `janitor` package, it facilitates common data wrangling tasks like cleaning column names, handling missing values, and method chaining. Currently at version 0.32.23, the library maintains an active development pace with frequent releases addressing performance, new features, and deprecations to align with evolving pandas APIs.

pip install pyjanitor
INSTALL
IMPORT
SIG · PYJANITOR
P
pyjanitor
datapythonv0.32.23
Install
13.6s avg
Import
4395ms
Disk
328MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.32.23 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 2.634s · 327.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 13.6s · import 2.641s · 315MB
328MB installed
● package 328MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

janitor
import janitor
Imports pyjanitor's functionality, registering its methods as pandas DataFrame accessors/methods.
pandas
import pandas as pd
pandas is a prerequisite for pyjanitor's functionality.

This quickstart demonstrates how to install pyjanitor, import it alongside pandas, and use the `clean_names()` function to standardize column headers in a DataFrame for easier manipulation. This function automatically converts names to lowercase and replaces spaces and special characters with underscores.

import pandas as pd import janitor # Sample DataFrame with messy column names data = { 'First Name': ['Alice', 'Bob'], 'Last-Name': ['Smith', 'Johnson'], 'AGE (Years)': [24, 30] } df = pd.DataFrame(data) print("Original DataFrame:\n", df) # Clean column names using pyjanitor's clean_names() cleaned_df = df.clean_names() print("\nCleaned DataFrame:\n", cleaned_df) print("\nCleaned column names:", cleaned_df.columns.tolist())
Debug
Known issues
deprecatedThe `mutate` DataFrame method has been deprecated. Users are advised to transition to alternative approaches for adding or modifying columns.
fix
Use `pd.DataFrame.assign` for general column additions/modifications. For groupby operations, utilize the `assign` method directly on the groupby object: `df.groupby('col').assign(...)` which was introduced in v0.32.18.
affects: >=0.32.17
breakingDirect usage of 'by' methods for groupby operations on DataFrames has been migrated to be directly available on groupby objects for improved API consistency.
fix
Ensure that `groupby` operations access methods directly on the `DataFrameGroupBy` object returned by `.groupby()`. Review documentation examples for updated patterns.
affects: >=0.32.20
deprecatedFunctions like `add_column`, `add_columns`, `remove_columns`, `rename_column`, `rename_columns`, and `filter_on` are slated for deprecation in a future 1.x release, as their functionality largely overlaps with native pandas methods.
fix
Prefer native pandas functions such as `pd.DataFrame.assign`, `pd.DataFrame.drop`, `pd.DataFrame.rename`, and `pd.DataFrame.query` where possible.
affects: Future 1.x releases (warnings may appear in 0.x).
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyjanitor'
The pyjanitor package is not installed in the current Python environment or the environment in use is not the one where pyjanitor was installed.
fix
Ensure pyjanitor is installed in your active environment: `pip install pyjanitor`. If using virtual environments, activate the correct environment before running your code.
AttributeError: 'DataFrame' object has no attribute 'clean_names'
The `janitor` module was not imported, which means its DataFrame accessor methods have not been registered with pandas.
fix
Add `import janitor` to your script after `import pandas as pd`. This registers pyjanitor's functions as DataFrame methods.
TypeError: 'DataFrameGroupBy' object has no attribute 'mutate' (or similar for other deprecated methods on groupby objects)
Attempting to use a deprecated pyjanitor method on a pandas GroupBy object, or before the relevant methods were added to GroupBy objects.
fix
For operations on grouped DataFrames, use `df.groupby(...).assign(...)` instead of `mutate`. Refer to pyjanitor's documentation for the correct methods available on GroupBy objects for your version.
Upgrade
Version history
0.32.23latest on PyPI · released Apr 7, 2026
Audit
Dependencies
pandasrequiredCore dependency; pyjanitor extends pandas DataFrames.
Agent activity
6 hits · last 30 days
node
6
Resources
pyjanitor — pip install pyjanitor · libregistry