data-preparation
Skill2 starsChanged 12 days agoMITView on GitHub
Data Preparation. Clean, join and split data without leakage - data cleaning, joins and merges with row-count checks, deduplication, missing value imputation, type fixes, outlier handling, train test split, validation split, cross-validation folds, stratified, group-aware and time-series (forward-chaining) splits, scikit-learn Pipeline and ColumnTransformer. Use for data wrangling, preprocessing, data cleaning, ETL for machine learning, or any request to prepare data for a model. CRISP-DM Data Preparation.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- lancegui/causal-powerstheir own version, first seen Oct 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- lancegui/causal-powers★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- ai-prediction-explainerSkill
- data-mining-machine-learningSkill
- data-miningSkill
- data-profilingSkill
- data-storytellingSkill
- feature-engineeringSkill
- hyperparameter-tuningSkill
- ml-quality-guardSkill
- ml-web-applicationSkill
- model-deploymentSkill
- model-evaluationSkill
- model-explainabilitySkill
- model-trainingSkill
- notebook-auditSkill
- problem-framingSkill
- statistical-analysisSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Every transformation is either a deterministic cleaning step (applied once, before splitting, with no learned statistics) or a learned step …
- Distinctive: line 25
Document: every transformation in the feature dictionary: what, why, and when the input is available.
- Distinctive: line 36
Never fill with a statistic computed on the full frame before splitting.
- Distinctive: line 46
No column recorded after the prediction time.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Data Preparation
Every transformation is either a deterministic cleaning step (applied once, before splitting, with no learned statistics) or a learned step (fitted inside the pipeline on training folds only). Mixing them up is the most common leak.
Order of work
- Deterministic cleaning, before the split. Fix types, parse dates, standardize units and category spellings, remove exact duplicates, drop rows with an invalid target, remove post-event columns. Print the row count after each step.
- Joins with assertions.
n = len(left) out = left.merge(right, on="customer_id", how="left", validate="many_to_one") assert len(out) == n, f"join changed rows: {n} -> {len(out)}" - Choose the split from the data (
references/split-strategies.md):- Independent rows, classification: stratified.
- Repeated entities: group-aware (
GroupKFold,StratifiedGroupKFold,GroupShuffleSplit). - Time-ordered data: forward-chaining (
TimeSeriesSplitor a cutoff date), with a gap equal to the label horizon. Fix and record the seed. Hold out the test set now; it is touched once, at evaluation.
- Learned steps inside the pipeline. Imputers, scalers, encoders, winsorizers, selectors, resamplers and target encoders go into a
ColumnTransformerandPipeline(or an imbalanced-learnPipelinewhen resampling). Fit happens on training folds only, through cross-validation or onefiton the training split. - Document every transformation in the feature dictionary: what, why, and when the input is available.
Missing values
| Mechanism | Default |
| MCAR, small share | SimpleImputer(strategy="median") |
| MAR | IterativeImputer or KNNImputer inside the pipeline |
| MNAR or informative | Imputer with add_indicator=True; state the assumption |
| Inference (statistics, not prediction) | Multiple imputation, pooled estimates |
Never fill with a statistic computed on the full frame before splitting.
Outliers
Decide error or signal first. Errors are fixed or removed with a written rule and a count. Signal is kept and handled with robust scaling, winsorizing inside the pipeline, or robust losses.
Checks before modeling
X_train.shape,X_test.shape, positive counts per split, no shared entity ids across splits.df.duplicated().sum()before splitting is zero or explained.- No column recorded after the prediction time.
- The pipeline object prints cleanly and
pipeline.fit(X_train, y_train)runs.
Conditions that change preparation (skew, zero inflation, high cardinality, drift): data-profiling/references/scenarios.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

