You start with .head() and .describe() when a new dataset arrives. Checking one column at a time takes longer as the number of columns grows. ydata-profiling generates an HTML report containing missing values, duplicate rows, distributions, correlations, and other details from a DataFrame. I installed it and tested report generation without network access.
ydata-profiling analyzes pandas DataFrames and generates an HTML report with per-column statistics, missing values, duplicate rows, and alerts. The project releases its source under the MIT License (*1).
1. Install It
FROM docker.io/library/python:3.12.13-slim
RUN pip install --no-cache-dir --quiet 'setuptools==70.0.0' 'ydata-profiling==4.18.4'
WORKDIR /work
The dependency libraries call pkg_resources, but recent setuptools releases no longer include that module. I pinned setuptools==70.0.0, which includes pkg_resources, as a working combination.
podman build -t ydata-profiling-sandbox .
2. Plant Six Anomalies and See Which Ones It Detects
I planted six anomalies common in production data in a synthetic dataset with 200 rows and 8 columns:
1. Missing values (6 in monthly_spend)2. Duplicate row (1)3. Constant column (region_code has the same value in every row)4. Column pair with a high correlation (age and age_months)5. Column with one unique value per row (session_id)6. Column dominated by zeros (refund_count is zero in 90% of rows)
Block network access before running it.
import numpy as np
import pandas as pd
from ydata_profiling import ProfileReport
rng = np.random.default_rng(0)
n = 200
age = rng.integers(18, 90, n)
df = pd.DataFrame({
"age": age,
"age_months": age * 12 + rng.integers(0, 3, n),
"signup_date": pd.date_range("2024-01-01", periods=n, freq="D"),
"plan": rng.choice(["free", "pro", "enterprise"], n, p=[0.6, 0.3, 0.1]),
"monthly_spend": rng.exponential(20, n),
"region_code": "JP-13",
"session_id": [f"sess-{i:06d}" for i in range(n)],
"refund_count": np.where(rng.random(n) < 0.9, 0, rng.integers(1, 4, n)),
})
df.loc[5:10, "monthly_spend"] = np.nan
df.loc[199] = df.loc[0]
profile = ProfileReport(df, title="Demo Dataset Profile")
profile.to_file("/work/report.html")
for alert in profile.get_description().alerts:
print(f"{alert.alert_type.name}: {alert}")
podman run --rm --network none --memory 2g --cpus 2 --pids-limit 512 \
-v "$(pwd)":/work -w /work ydata-profiling-sandbox \
python profile_rich_demo.py
-v makes the specified directory available for reads and writes from the container. Use a separate, empty directory for the experiment. During the run, the tool warned that the maintainers planned to replace deprecated ydata_profiling with data_profiling from the fg-data-profiling package. The tested version worked.
The output was:
alerts:
CONSTANT: [region_code] has a constant value
DUPLICATES: Dataset has 1 (0.5%) duplicate rows
HIGH_CORRELATION: [age] is highly overall correlated with [age_months]
HIGH_CORRELATION: [age_months] is highly overall correlated with [age]
IMBALANCE: [refund_count] is highly imbalanced (0.693564269159609)
MISSING: [monthly_spend] 6 (3.0%) missing values
The tool detected five of the six anomalies I planted, with exact counts and percentages for missing values, duplicates, the constant column, the high-correlation pair, and the zero-dominated column. The default settings did not flag that session_id had a unique value in every row. Keep that behavior in mind when you use the library to look for candidate primary keys.
3. Inspect the Generated Report
The tool prints several alert lines and writes an interactive HTML report. The report starts with statistics for the entire dataset.
Open the Alerts tab to see the six detected alerts with color-coded badges by type. Select a column name to jump to that column's detail section.
I measured generation cost. The full report took 5.6 seconds and produced a 1,561KB file. With minimal=True, it took 3.8 seconds and produced a 1,192KB file. I ran both tests on a 200-row, 8-column dataset and limited the CPU to 2 cores. At this size, generation time has little impact. The library calculates a correlation matrix and scatter plots, so minimal=True becomes more useful as the row and column counts grow.
Automate the First Look
You repeat the same first checks each time you receive a dataset: find out what it contains, then narrow the review. Let ydata-profiling handle that first look. It flags missing values, duplicate rows, constant columns, and high correlations, so you can focus on the fields that need review. The default settings have blind spots. The tool missed the column with one unique value per row in this run. Test the tool on your own data to learn which patterns it flags and which it ignores.
Sources
*1 ydata-profiling (GitHub), https://github.com/ydataai/ydata-profiling, MIT License