Skip to content

fix: KeyError in accuracyIndicators() when weightDict is a column subset#277

Open
FBumann wants to merge 1 commit intoFZJ-IEK3-VSA:developfrom
FBumann:fix/apply-weights-keyerror-276
Open

fix: KeyError in accuracyIndicators() when weightDict is a column subset#277
FBumann wants to merge 1 commit intoFZJ-IEK3-VSA:developfrom
FBumann:fix/apply-weights-keyerror-276

Conversation

@FBumann
Copy link
Copy Markdown
Collaborator

@FBumann FBumann commented Apr 16, 2026

Summary

  • accuracyIndicators() raised KeyError when weightDict didn't contain all columns in the data (e.g. when apply() is used with extra columns)
  • Use .get(column, 1) instead of [column] so unweighted columns default to weight 1
  • Added regression test

Closes #276

Test plan

  • Reproducer from issue no longer raises KeyError
  • New test test_apply_with_weights_and_extra_columns passes
  • All existing tests pass (481 passed)

🤖 Generated with Claude Code

…olumns

accuracyIndicators() iterated over all columns in normalizedTimeSeries
but accessed weightDict[column] without checking membership. This caused
a KeyError when apply() was used with data containing columns not in the
original weights. Use .get(column, 1) to default unweighted columns.

Closes FZJ-IEK3-VSA#276

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@FBumann FBumann requested a review from julian-belina April 16, 2026 12:21
@FBumann FBumann changed the title Fix KeyError in accuracyIndicators() when weightDict is a column subset fix: KeyError in accuracyIndicators() when weightDict is a column subset Apr 16, 2026
@FBumann FBumann added the bug label Apr 21, 2026
@julian-belina julian-belina self-assigned this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClusteringResult.apply() fails with KeyError when data has columns not in weights

2 participants