You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix InvalidIndexError: Non-unique indices during DataFrame concatenation. The error occurs because pandas is trying to concatenate DataFrames where the indices are not unique, which happens when we're combining results from multiple features and their bins.
This pull request refactors the WeakspotsDiagnosis function in the WeakspotsDiagnosis.py file to improve data handling and metric computation. The key changes include:
Renaming Columns: The column previously named "Shape" has been renamed to "Number of Records" to better reflect its content.
DataFrame Initialization: The results DataFrames results_1 and results_2 are now initialized outside the loop, allowing for the accumulation of results across iterations.
Refactoring Metric Computation: The metric computation logic has been refactored to use temporary dictionaries r1 and r2 for storing intermediate results, which are then concatenated into the main results DataFrames.
Improved Sorting and Indexing: The final DataFrame is now reset for its index and sorted by "Feature" and "Dataset" columns, ensuring a consistent and clear output format.
These changes aim to enhance the clarity and efficiency of the code, particularly in how results are accumulated and presented.
Test Suggestions
Verify that the column name change from 'Shape' to 'Number of Records' is correctly reflected in all outputs.
Test the WeakspotsDiagnosis function with datasets containing both categorical and continuous features to ensure correct binning and metric computation.
Check that the final DataFrame output is correctly sorted by 'Feature' and 'Dataset'.
Ensure that the function handles empty dataframes correctly without errors.
Validate that the visual assessment logic for weak spots remains functional and accurate.
johnwalz97
deleted the
juan/sc-9112/fix-indices-error-in-weakspots-diagnosis-when-using-input_grid
branch
August 20, 2025 17:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workinginternalNot to be externalized in the release notes
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Internal Notes for Reviewers
Fix InvalidIndexError: Non-unique indices during DataFrame concatenation. The error occurs because pandas is trying to concatenate DataFrames where the indices are not unique, which happens when we're combining results from multiple features and their bins.
External Release Notes