Skip to content

Add map wrangle for semantic column name mapping - #903

Closed
mborodii-prog with Copilot wants to merge 3 commits into
mainfrom
copilot/add-map-wrangle
Closed

Add map wrangle for semantic column name mapping#903
mborodii-prog with Copilot wants to merge 3 commits into
mainfrom
copilot/add-map-wrangle

Conversation

Copilot AI commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Implements automatic column renaming using semantic similarity, providing programmatic equivalent of Wrangles XL's manual column mapping UI.

Implementation

  • Similarity algorithm: difflib.SequenceMatcher calculates text similarity ratios between current and target column names
  • Matching strategy: Greedy best-match-first; each target column used once, highest similarity wins
  • Configurable parameters:
    • to: Target column name(s) - required
    • threshold: Minimum similarity ratio (0-1), default 0.6
    • case_sensitive: Boolean, default False
  • Behavior: Columns below threshold retain original names

Usage

wrangles:
  - map:
      to:
        - Product Name
        - Product Code  
        - Manufacturer
      threshold: 0.5

Maps columns like product_nameProduct Name, prod_codeProduct Code based on similarity scores. Unmapped columns (e.g., xyz) remain unchanged.

Testing

Added 9 test cases covering threshold behavior, case sensitivity, single/multiple targets, partial matching, and greedy allocation when multiple columns compete for the same target.

Original prompt

This section details on the original issue you should resolve

<issue_title>Map</issue_title>
<issue_description>Just as with Wrangles XL, create a map wrangle for Wrangles PY.</issue_description>

<agent_instructions>Create a new wrangle called map that uses semantic similarity to automatically map input column names to a user defined list of column names.
Add tests for the new map wrangle that cover all use cases.
The new wrangle should be defined in wrangles/recipe_wrangles/main.py</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@thomasstvr Is this not the same as rename? @ChrisWRWX I was more thinking of adding the possibility to use the equivalent of the magic button to auto-map the columns. Doing it manually is effectively just rename as you say. @ebhills similarity / rename / semantic lup @thomasstvr Requirements: - Create a new wrangle called map that uses semantic similarity to automatically map input column names to a user defined list of column names. - Add tests for the new map wrangle that cover all use cases. - The new wrangle should be defined in wrangles/recipe_wrangles/main.py

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 16, 2026 14:12
Co-authored-by: mborodii-prog <242361445+mborodii-prog@users.noreply.github.com>
Co-authored-by: mborodii-prog <242361445+mborodii-prog@users.noreply.github.com>
Copilot AI changed the title [WIP] Add map wrangle for Wrangles PY with semantic similarity Add map wrangle for semantic column name mapping Feb 16, 2026
Copilot AI requested a review from mborodii-prog February 16, 2026 14:16

ebhills commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Queue triage (2026-07-27): closing this Copilot draft as the duplicate implementation for issue #320. Continue the scoped design/implementation discussion on #905 (or return it to #320 if a clean rebuild is chosen).

@ebhills ebhills closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map

3 participants