[fix] Ensure sunburst column ordering adheres to hierarchy#9011
Merged
john-bodley merged 1 commit intoJan 24, 2020
Merged
Conversation
353d036 to
a2c96ac
Compare
serenajiang
reviewed
Jan 24, 2020
| def get_data(self, df: pd.DataFrame) -> VizData: | ||
| fd = self.form_data | ||
| cols = fd.get("groupby") | ||
| cols = fd.get("groupby") or [] |
Contributor
There was a problem hiding this comment.
Suggested change
| cols = fd.get("groupby") or [] | |
| cols = fd.get("groupby", []) |
serenajiang
reviewed
Jan 24, 2020
| # Re-order the columns as the query result set column ordering may differ from | ||
| # that listed in the hierarchy. | ||
| df = df[cols] | ||
| return df.to_numpy().tolist() |
Member
Author
There was a problem hiding this comment.
@serenajiang per the documentation they mention,
Warning We recommend using DataFrame.to_numpy() instead.
serenajiang
approved these changes
Jan 24, 2020
williaster
reviewed
Jan 24, 2020
Contributor
williaster
left a comment
There was a problem hiding this comment.
thanks @john-bodley !
12 tasks
qfcwell
pushed a commit
to qfcwell/superset
that referenced
this pull request
May 12, 2026
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.
CATEGORY
Choose one
SUMMARY
This PR fixes an issue where the values for the sunburst chart (which takes in a list of lists order by the hierarchical columns) were being named incorrectly. The reason being is the resulting
pandas.DataFramecolumn ordering is not the same as the ordering defined in the hierarchy.The fix is to simply re-order the
pandas.DataFramecolumns to adhere to the column ordering specified in the hierarchy.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
Tested locally for a chart where there were more than one hierarchies defined and confirmed that the ordering of the layers in the chart were correct.
ADDITIONAL INFORMATION
REVIEWERS
to: @etr2460 @mistercrunch @williaster