-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Setting category_orders was leading to missing data #4877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b0a57f6
to
ad2c0a5
Compare
if len(single_group_name) == len(grouper): | ||
# we have a single group, so we can skip all group-by operations! | ||
groups = {tuple(single_group_name): df} | ||
else: | ||
required_grouper = list(orders.keys()) | ||
required_grouper = [ | ||
key for key in orders if key in grouper and key != one_group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe one_group
will never be in orders
so this can be simplified to
key for key in orders if key in grouper and key != one_group | |
key for key in orders if key in grouper |
packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py
Outdated
Show resolved
Hide resolved
…_px.py Co-authored-by: Emily KL <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me @MarcoGorelli , thanks for the quick fix. 🙌 🚀
@LiamConnors Can you confirm this change fixes the issue for you?
thanks for your review! sorry for the repeated pushes, kept noticing minor improvements |
Thanks Marco! Apologies for messing this one up 🥲 |
Looks good to me too. Thanks @MarcoGorelli ! |
No worries @FBruzzesi , you've just discovered we didn't have a test for this case! |
closes #4875
The bug in https://github.com/plotly/plotly.py/pull/4790/files was the change
and in the linked issue #4875, the group
'day'
appears inorders
but not inrequired_grouper
I've added a test - here's a visual demo too:
Output is also unchanged (compared with the latest PyPI release) when multiple groups point to the same column: