Numeric-Categorical Auto Detection
SkillDev toolsAuto-detect whether a generated data series is numeric or categorical by measuring the fraction of digit characters in the concatenated values
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Numeric-Categorical Auto Detection skill
What this skill tells your AI
The instructions your AI receives, as published by wenmin-wu/ds-skills in skills/cv/numeric-categorical-auto-detection/SKILL.md and read by ahel’s review.
Overview
When a generative model produces data series from charts, the output is always strings — but downstream processing differs for numeric values (float parsing, RMSE scoring) vs categorical values (string matching, Levenshtein scoring). Auto-detect the data type by computing the digit-character fraction of the concatenated series. If ≥50% of characters are digits, treat as numeric and parse; otherwise treat as categorical strings.
Quick Start
import re
def detect_series_type(values):
all_chars = "".join(values)
if len(all_chars) == 0:
return "categorical"
digit_chars = len(re.sub(r"[^\d]", "", all_chars))
frac_numeric = digit_chars / len(all_chars)
return "numeric" if frac_numeric >= 0.5 else "categorical"
def process_series(values):
if detect_series_type(values) == "numeric":
return clean_numeric(values) # parse to float/int
else:
return [s.strip() for s in values] # keep as strings
x_series = ["2020", "2021", "2022"]
y_series = ["Apple", "Banana", "Cherry"]
detect_series_type(x_series) # "numeric"
detect_series_type(y_series) # "categorical"
Workflow
- Concatenate all values in the series into a single string
- Count digit characters using
re.sub(r"[^\d]", "", text) - Compute fraction: digit_count / total_length
- If fraction ≥ 0.5 → numeric (parse with float/int)
- If fraction < 0.5 → categorical (keep as stripped strings)
Key Decisions
- 0.5 threshold: balanced cutoff; numeric series like "12.5" have ~80% digits, labels like "Q1 2023" have ~40%
- Concatenated check: more robust than per-value — a single "N/A" in a numeric series won't flip the type
- Digit-only count: counts 0-9 only — decimals, signs, and spaces don't count as "numeric evidence"
- Fallback: empty series defaults to categorical (safer for downstream processing)
References
Signals
- GitHub stars
- 60
- Forks
- 4
- Last commit
- Apr 2026
Advanced
- Catalog kind
- skill
- Gateway key
cv-numeric-categorical-auto-detection- Source
- github.com/wenmin-wu/ds-skills