[data-platform] filter tool adds unexpected __index_level_0__ column #204

Closed
opened 2026-01-26 22:21:12 +00:00 by lmiranda · 0 comments
Owner

User-Reported Issue

Reported: 2026-01-26T17:20:00-05:00
Reporter: Claude Code via /debug-report (user feedback)

Context

Field Value
Plugin data-platform
Command/Tool filter
Repository personal-projects/personal-portfolio
Working Directory /home/lmiranda/Repositories/personal/personal-portfolio
Branch development

Problem 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 filter tool on a DataFrame, the resulting DataFrame includes an extra column __index_level_0__ that was not present in the original data.

Example:

Original DataFrame (sales): 4 columns - date, product, quantity, price

After filter(sales, 'quantity > 5'): 5 columns - date, product, quantity, price, index_level_0

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 select after filter to drop the unwanted column, but this is not intuitive.

Investigation Hints

Relevant files to check:

  • mcp-servers/data-platform/mcp_server/tools/dataframe_ops.py - likely contains filter implementation
  • Look for how the DataFrame is stored after filtering - the index may be getting converted to a column

Suggested Fix

In the filter tool implementation, after applying the pandas query, reset the index with .reset_index(drop=True) before storing the filtered result.


Generated by /debug-report (user feedback) - Labels: Type/Bug, Component/API

## User-Reported Issue **Reported**: 2026-01-26T17:20:00-05:00 **Reporter**: Claude Code via /debug-report (user feedback) ## Context | Field | Value | |-------|-------| | Plugin | `data-platform` | | Command/Tool | `filter` | | Repository | `personal-projects/personal-portfolio` | | Working Directory | `/home/lmiranda/Repositories/personal/personal-portfolio` | | Branch | `development` | ## Problem 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 `filter` tool on a DataFrame, the resulting DataFrame includes an extra column `__index_level_0__` that was not present in the original data. **Example:** Original DataFrame (sales): 4 columns - date, product, quantity, price After filter(sales, 'quantity > 5'): 5 columns - date, product, quantity, price, __index_level_0__ ### 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 `select` after `filter` to drop the unwanted column, but this is not intuitive. ## Investigation Hints Relevant files to check: - mcp-servers/data-platform/mcp_server/tools/dataframe_ops.py - likely contains filter implementation - Look for how the DataFrame is stored after filtering - the index may be getting converted to a column ## Suggested Fix In the filter tool implementation, after applying the pandas query, reset the index with `.reset_index(drop=True)` before storing the filtered result. --- *Generated by /debug-report (user feedback) - Labels: Type/Bug, Component/API*
lmiranda added the Component/APIType/Bug labels 2026-01-26 22:21:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#204