Skip to content

Pass tuple to get_group to fix warning - #4519

Merged
LiamConnors merged 2 commits into
masterfrom
fix-grouping
Feb 15, 2024
Merged

Pass tuple to get_group to fix warning#4519
LiamConnors merged 2 commits into
masterfrom
fix-grouping

Conversation

@LiamConnors

@LiamConnors LiamConnors commented Feb 13, 2024

Copy link
Copy Markdown
Contributor

#4500

Code PR

  • I have read through the contributing notes and understand the structure of the package. In particular, if my PR modifies code of plotly.graph_objects, my modifications concern the codegen files and not generated files.
  • I have added tests (if submitting a new feature or correcting a bug) or
    modified existing tests.
  • For a new feature, I have added documentation examples in an existing or
    new tutorial notebook (please see the doc checklist as well).
  • I have added a CHANGELOG entry if fixing/changing/adding anything substantial.
  • For a new feature or a change in behaviour, I have updated the relevant docstrings in the code to describe the feature or behaviour (please see the doc checklist as well).

@LiamConnors LiamConnors changed the title Silence FutureWarning: When grouping with a length-1 list-like... Pass tuple to get_group to fix warning Feb 13, 2024
@alexcjohnson

Copy link
Copy Markdown
Collaborator

@LiamConnors this looks great! Can we add a test, perhaps in test_px_input.py but similar to this one in test_px_wide.py? And I guess increase the pandas version in requirements_39_pandas_2_optional.txt to 2.2?

with warnings.catch_warnings(record=True) as warn_list:
_ = px.bar(
df,
x=df.index,
y=df.columns[:-2],
labels=df.columns[:-2],
)
performance_warnings = [
warn
for warn in warn_list
if issubclass(warn.category, pd.errors.PerformanceWarning)
]
assert len(performance_warnings) == 0, "PerformanceWarning(s) raised!"

@LiamConnors

Copy link
Copy Markdown
Contributor Author

Thanks! @alexcjohnson! I've added a test now

@alexcjohnson alexcjohnson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 Beautiful! Just wants a changelog entry.

@LiamConnors
LiamConnors merged commit 2451671 into master Feb 15, 2024
@LiamConnors
LiamConnors deleted the fix-grouping branch February 15, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants