Skip to content

fix: handle missing values in column profiling - #1150

Merged
andreatnvidia merged 3 commits into
NVIDIA-NeMo:mainfrom
williamcaban:williamcaban/fix/1144-profiling-missing-values
Nov 11, 2026
Merged

andreatnvidia merged 3 commits into
NVIDIA-NeMo:mainfrom
williamcaban:williamcaban/fix/1144-profiling-missing-values

Conversation

@williamcaban

Copy link
Copy Markdown
Contributor

📋 Summary

Fixes three cases where profiling failed or misreported because a statistic is undefined or a missing value is pd.NA: the output-token stddev of a single-record LLM column on pandas 3.1+, the distribution of a single-record numerical column, and the null and unique counts of nullable columns. Done as one profiling PR as discussed on #1144 and #1147.

🔗 Related Issue

Fixes #1144
Fixes #1147

🔄 Changes

🐛 Fixed

🧪 Testing

  • make test passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

make needs uv 0.13.4 or newer, so I ran the same suites with pytest directly (config 834, engine 2981, interface 1337 passed). They pass on the locked pandas 3.0.5 and on 3.1.1, and ruff format and ruff check are clean on the changed files.

New tests:

  • Engine: single-record and multi-record Arrow-backed output stats, nine missing-value count cases (nullable int, float, string, boolean, Arrow string, all-null, object), and nested values that still need hashing for uniqueness.
  • Config: NumericalDistribution.from_series for one value on NumPy, nullable and Arrow float series, and a multi-value Arrow series.
  • Interface: preview and create for nullable seeds and for a single-record sampler.

On pandas 3.1.1 without the fix 13 tests fail, 11 of them new. The other two are existing tests (test_calculate_general_column_info and the profiler Jinja-engine test) that main also fails on 3.1.1.

I did not add a plan document because the change is small and limited to the statistics code. Happy to add one if you prefer.

✅ Checklist

  • Follows commit message conventions
  • Commits are signed off (DCO)
  • If I am an external contributor, the linked issue is open and labeled triaged
  • Architecture docs updated (if applicable)

🤖 Generated with Claude Code

Profiling failed or misreported in three cases where pandas leaves a
statistic undefined or represents a missing value as pd.NA:

- Output token statistics of an LLM column with a single record raised
  "float() argument must be ... not 'NAType'" on pandas 3.1+, because
  Series.apply keeps the Arrow backing and its sample stddev is pd.NA.
  Compute them on a float64 series.
- A single-record numerical column dropped its whole distribution for the
  same reason. Report the undefined stddev as NaN and keep min, max, mean
  and median.
- General column info counted a missing value as the distinct string
  "<NA>" (ensure_hashable), so num_null was 0 and num_unique one too high
  for nullable numeric, string and boolean columns. Count nulls on the
  original column and leave them out of the unique count.

Fixes NVIDIA-NeMo#1144
Fixes NVIDIA-NeMo#1147

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: William Caban <william.caban@gmail.com>
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@williamcaban

Copy link
Copy Markdown
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable bugs or repository-rule violations were found.

Summary

Fixes profiling for nullable columns and single-record datasets.

  • Single-record numerical profiles keep their defined statistics.
  • Nullable columns report missing values separately from unique values.
  • LLM output profiles keep token statistics for one-row columns.

Reviews (3) · Last reviewed commit: "Merge branch 'main' into williamcaban/fi..." · Reviewed by Greptile

@williamcaban

Copy link
Copy Markdown
Contributor Author

recheck

andreatnvidia
andreatnvidia previously approved these changes Nov 10, 2026

@andreatnvidia andreatnvidia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling both issues together! This addresses #1144 and #1147, including preserving the defined statistics for single-record numerical samplers.

Looks good to merge.

Create a one-record numerical dataset, check that the undefined
standard deviation survives the saved metadata JSON, then resume the
completed run and check the re-profiled distribution.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: William Caban <william.caban@gmail.com>
@andreatnvidia
andreatnvidia enabled auto-merge (squash) November 11, 2026 10:57
@andreatnvidia
andreatnvidia merged commit 2d5857e into NVIDIA-NeMo:main Nov 11, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants