fix(data-platform): reset index after filter to prevent extra column
The filter tool was adding an __index_level_0__ column to results because pandas query() preserves the original index, which gets converted to a column when storing the DataFrame. Added .reset_index(drop=True) after query() to drop the preserved index and create a clean sequential index. Fixes #203 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -330,7 +330,7 @@ class PandasTools:
|
|||||||
return {'error': f'DataFrame not found: {data_ref}'}
|
return {'error': f'DataFrame not found: {data_ref}'}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filtered = df.query(condition)
|
filtered = df.query(condition).reset_index(drop=True)
|
||||||
result_name = name or f"{data_ref}_filtered"
|
result_name = name or f"{data_ref}_filtered"
|
||||||
return self._check_and_store(
|
return self._check_and_store(
|
||||||
filtered,
|
filtered,
|
||||||
|
|||||||
Reference in New Issue
Block a user