Repository navigation
fix: keep columns that share a title instead of overwriting them - #5
Merged
Merged
Conversation
get_data keyed renamed columns by title, so when two columns share a title (85592NED has "Transporttarief" under both Aardgas and Elektriciteit) the later one silently replaced the earlier: the gas tariff columns came back holding electricity values. columns= had the same collision and selected the electricity column. Shared titles are now prefixed with their topic group, falling back to the CBS key, and columns= raises on a shared title rather than guessing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
get_datanamed each column by its CBS title. When two columns share a title, the later one overwrote the earlier without any warning. 85592NED (consumer energy prices) has six titles that appear under both Aardgas and Elektriciteit, so all six gas columns came back holding electricity values.columns=had the same collision:columns=["Transporttarief"]quietly selected the electricity column.Titles that aren't shared are unchanged, so existing column names stay the same. The getting-started docs now describe the rule.
Evidence
get_data("85592NED")returns 11 columns, andTransporttariefholds 394.11 €/yr, which is the electricity tariff.After: it returns 17 columns, with
Aardgas: Transporttarief= 221.79 andElektriciteit: Transporttarief= 394.11. Both match the raw OData values (Transporttarief_1,Transporttarief_7) for September 2026, excluding VAT.get_data("85592NED", columns=["Transporttarief"])raisesValueError: 'Transporttarief' is the title of several columns in 85592NED; use one of ['Aardgas: Transporttarief', 'Elektriciteit: Transporttarief'].TestGetDataDuplicateTitles, all four failing onmainand passing here:test_shared_titles_are_qualified_by_grouptest_shared_titles_without_group_fall_back_to_keytest_columns_accepts_qualified_titletest_columns_rejects_shared_titleruff check,ruff format --checkandty checkare clean.Merge Danger
Door: two-way
Blast Radius: column names
TransporttariefbecomesAardgas: Transporttarief/Elektriciteit: Transporttarief. Code that indexed the bare name breaks with aColumnNotFoundError. It was reading the wrong series before, so failing loudly is the intended outcome.columns=with a shared bare title now raises rather than picking one.🤖 Generated with Claude Code