[data-platform] filter tool adds unexpected __index_level_0__ column #203
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User-Reported Issue
Reported: 2026-01-26T17:20:00-05:00
Reporter: Claude Code via /debug-report (user feedback)
Context
data-platformfilterpersonal-projects/personal-portfolio/home/lmiranda/Repositories/personal/personal-portfoliodevelopmentProblem Description
Goal
Filter DataFrame rows by condition and get a result with the same schema as the source DataFrame.
What Happened
Problem Type: Unexpected behavior
When using the
filtertool on a DataFrame, the resulting DataFrame includes an extra column__index_level_0__that was not present in the original data.Example:
This was observed in the
list_dataoutput:Expected Behavior
The filtered DataFrame should have the same columns as the source DataFrame (4 columns, not 5). The pandas index should either be reset or not exposed as a column in the stored result.
Workaround
None identified. Users could potentially use
selectafterfilterto drop the unwanted column, but this is not intuitive.Investigation Hints
Based on the affected plugin/command, relevant files to check:
mcp-servers/data-platform/mcp_server/tools/dataframe_ops.py- likely contains filter implementation.reset_index(drop=True)before storing the filtered resultSuggested Fix
In the filter tool implementation, after applying the pandas query, reset the index:
This will drop the original index and create a new sequential index, preventing the
__index_level_0__column from appearing.Generated by /debug-report (user feedback) - Labels: Type/Bug, Component/API
Resolution
Fixed in branch
fix/data-platform-filter-index(commit4ed3ed7).Root cause:
df.query()preserves the original DataFrame index. When the filtered result is stored, the index gets converted to a column named__index_level_0__.Fix: Added
.reset_index(drop=True)after the query operation inpandas_tools.py:333:Merged via PR #204.