fix: count rows per cell when heatmap C is not set - #1743
Open
ghostiee-11 wants to merge 1 commit into
Open
Conversation
heatmap documents C as optional, with a simple count used when it is
omitted, but omitting it raised "NoneType type could not be interpreted
as Dimension". core.py always forwards C=C, so C=None was present in
kwds and self.kwds.get('C', fallback) never reached its fallback.
Resolve C with a plain get and count the rows in each (x, y) cell when
it is None, so the documented behaviour works. This also makes the two
entry points agree: df.hvplot(kind='heatmap') previously plotted the
first non-x/y column, picked arbitrarily, and now counts as well.
The grouping runs after _process_chart_args so that derived dimensions
such as 'time.hour' are real columns by then, and passes observed=True
to keep categorical axes from expanding into the full product of their
categories.
hover_cols and reduce_function cannot apply to a cell holding a count,
so they are now reported as ignored rather than silently dropped, and
reduce_function is skipped in that case because np.size would otherwise
flatten every count to 1.
Fixes holoviz#1610
Fixes holoviz#908
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.
df.hvplot.heatmap(x, y) raised ValueError: NoneType type could not be interpreted as Dimension instead of plotting, even though C is documented as optional with "a simple count" as the default. This makes that documented count actually work.
Fixes #1610. Fixes #908, which is the same crash reached through a lowercase c= typo.