Skip to content

Getting Started

benzsevern edited this page Mar 29, 2026 · 1 revision

Getting Started

Installation

pip install infermap

Optional extras

Extra What it adds
infermap[postgres] PostgreSQL support via psycopg2
infermap[mysql] MySQL support
infermap[duckdb] DuckDB support
infermap[excel] Excel file support via openpyxl
infermap[all] Everything

Your First Mapping

import infermap

# Map a messy CRM export to a clean target schema
result = infermap.map("crm_export.csv", "canonical_customers.csv")

# See what matched and why
for m in result.mappings:
    print(f"{m.source} -> {m.target} (confidence: {m.confidence:.2f})")
    print(f"  Reasoning: {m.reasoning}")

# Remap a DataFrame
remapped = result.apply(source_df)

# Save for reuse (skips inference next time)
result.to_config("mapping.yaml")

Map to a Database

result = infermap.map(
    "incoming.csv",
    "postgresql://user:pass@host/db",
    table="customers",
    required=["email", "phone"],
)

The DB provider introspects the live schema at runtime — if columns change, the mapping adapts automatically.

CLI Quick Start

# Map two files
infermap map source.csv target.csv

# See what's in a file
infermap inspect source.csv

# Save and reuse a mapping
infermap map source.csv target.csv -o mapping.yaml
infermap apply new_data.csv --config mapping.yaml -o remapped.csv

# CI gate: fail if required fields aren't mapped
infermap validate source.csv --config mapping.yaml --strict --required email,phone

Clone this wiki locally