Resolve custom-labelled dimensions by name in GeoPandasInterface#843
Open
gaoflow wants to merge 1 commit into
Open
Resolve custom-labelled dimensions by name in GeoPandasInterface#843gaoflow wants to merge 1 commit into
gaoflow wants to merge 1 commit into
Conversation
A dim() expression referencing a column builds a Dimension whose label is the column name. Dimension equality compares labels, so get_dimension() returned None when the element declared that dimension with a custom label, and isscalar/values/range crashed with AttributeError: 'NoneType' object has no attribute 'name' during rendering. Fall back to looking the dimension up by name, which matches names and labels, mirroring the string lookup path. Fixes holoviz#840
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.
Fixes #840.
A
dim('status')expression builds aDimensionwhose label is the column name.Dimension.__eq__compares labels, so when the element declares that dimension with a custom label —vdims=[('status', 'Conservation Status')]—dataset.get_dimension(dim)returnsNone, andGeoPandasInterface.isscalarcrashes withAttributeError: 'NoneType' object has no attribute 'name'during bokeh range computation.valuesandrangefail the same way with the same probe.This adds a
_resolve_dimensionhelper that falls back to looking the dimension up by name — the string lookup path already matches both names and labels via itsname_map— and uses it inisscalar,rangeandvalues. Also drops a leftover duplicateget_dimensioncall inisscalar.The regression test covers the three interface methods plus the render path from the issue.