Data Cleaner: Messy CSV & Excel to Tidy Data

    by Ignasi

    1

    Profile, clean, and deduplicate messy CSV/Excel data with a reproducible Python script and detailed change logs.

    Free

    1 useSecurity scanned

    Works with the AI Agents you already use

    Data Cleaner: Messy CSV & Excel to Tidy Data

    Example session with this skill installed

    I have a messy customers.csv with weird dates, duplicate names like 'BCN' vs 'Barcelona', and European price formats. Profile it and give me a cleaning plan.

    • Read your context and instructions
    • Compiled the data cleaner
    • Generated the data export

    I have profiled customers.csv. The file contains 1,240 rows with 8 columns. I detected latin-1 encoding and a semicolon delimiter. Column price uses a comma decimal separator (e.g., 1.250,50). Column city has 4 variants for Barcelona and 3 for Madrid.

    Data Cleaning Plan

    StepTransformationDetail
    1Header NormalisationConvert headers to snake_case (e.g., 'Customer Name' -> customer_name).
    2Type CastingConvert price to float by removing . and replacing , with ..
    3Date StandardisationParse signup_date using dayfirst=True to ISO YYYY-MM-DD.
    4Categorical MappingMap 'BCN', 'barcelona ', 'Barcelona' to 'Barcelona'.
    5DeduplicationFuzzy match customer_name + email with a 90% threshold.
    6ValidationEnsure customer_id is unique and email follows E.164 format.

    Reproducible Cleaning Script

    import pandas as pd
    import numpy as np
    from rapidfuzz import process, utils
    
    def clean_data(filepath):
        # Load with detected settings
        df = pd.read_csv(filepath, sep=';', encoding='latin-1')
        
        # 1. Headers
        df.columns = [c.lower().strip().replace(' ', '_') for c in df.columns]
        
        # 2. Prices (European format)
        df['price'] = df['price'].str.replace('.', '').str.replace(',', '.').astype(float)
        
        # 3. Dates
        df['signup_date'] = pd.to_datetime(df['signup_date'], dayfirst=True).dt.strftime('%Y-%m-%d')
        
        # 4. City Normalisation
        city_map = {'BCN': 'Barcelona', 'barcelona ': 'Barcelona'}
        df['city'] = df['city'].replace(city_map)
        
        return df
    
    if __name__ == "__main__":
        cleaned_df = clean_data('customers.csv')
        cleaned_df.to_csv('customers_clean.csv', index=False)
        print("Cleaning complete. 1,240 rows processed.")
    

    Next steps

    1. Confirm the categorical mapping for city variants.
    2. Specify if you want outliers in the price column flagged or moved to rejected_rows.csv.
    3. Run the provided script locally to generate the final customers_clean.csv.

    customers.csv

    CSV · data export

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Dirty data ruins analysis and breaks imports. This skill takes messy CSV, Excel, or JSON files and transforms them into tidy, validated datasets while generating a reproducible Python script for your pipeline.

    What it does

    • Data profiling scans every column to detect encoding, mixed types, unique counts, and anomalies before touching a single row.
    • Normalisation fixes headers to snake_case, strips whitespace, corrects encoding mojibake, and standardises categorical variants.
    • Locale-aware parsing handles complex number formats like European decimals and ambiguous date formats into ISO standard.
    • Deduplication performs exact and fuzzy matching with confidence scoring to catch duplicate records without silent data loss.
    • Validation and logging generates a change log and a rejected_rows file so you can audit every transformation and reconcile row counts.

    How it works

    1. Profile: The agent analyzes your file and reports on null percentages, data types, and potential issues like empty rows.
    2. Plan: It presents a numbered cleaning plan tailored to your target (e.g., CRM import vs. financial analysis) for approval.
    3. Clean: Once confirmed, it applies transformations including type casting, outlier flagging, and categorical mapping.
    4. Export: It delivers the cleaned data, a list of rejected rows, and a standalone Python script for future use.

    Frameworks & tools

    Uses pandas or polars for processing, ftfy for text encoding fixes, and rapidfuzz for high-performance fuzzy matching.

    Why this beats prompting it yourself

    Generic prompts often hallucinate data or silently delete rows when they encounter parsing errors. This skill follows a rigorous multi-step protocol that ensures row count reconciliation and provides the actual Python code so you aren't locked into an AI black box.

    Use cases

    • Preparing messy marketing exports for a CRM or database import.
    • Standardising financial spreadsheets with inconsistent date and currency formats.
    • Cleaning user-generated data for machine learning model training.
    • Merging disparate lists with fuzzy name and address matching.

    Known limitations

    The skill handles files within your context window limits. For extremely large datasets, it provides the cleaning script to run locally rather than processing the entire file in-session.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    1 use

    Times used to date

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 11 days ago

    • Free with an Agensi account

    Permissions

    Read Files
    Listed11 days ago

    What's inside

    Frequently Asked Questions

    This skill handles CSV, Excel (.xlsx, .xls), and JSON files, and is compatible with any AI agent or platform that supports file uploads and Python-based data processing environments.

    Unlike generic prompts that might silently drop rows, this skill uses a rigorous reconciliation process that generates a change log and a 'rejected_rows' file to ensure every record is accounted for.

    For datasets exceeding context window limits, the agent profiles a sample to build the logic and then provides a standalone Python script using Pandas or Polars for you to run locally on the full dataset.

    You receive the full agent workflow, access to the specific data-cleaning protocol, and the ability to generate standalone Python scripts that use libraries like ftfy and rapidfuzz.

    Yes, the agent first profiles your data and presents a numbered cleaning plan for your approval, allowing you to tailor transformations for specific targets like CRM imports or ML training.

    New in LLM Ops

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.

    Free