Skip to content
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

Consider necessary columns from complex arguments when interchanging dataframes #4324

Merged
merged 5 commits into from Aug 15, 2023

Conversation

guyrosin
Copy link
Contributor

This PR fixes a regression from #4286, where only plain string arguments were considered as necessary columns when interchanging dataframes. This PR considers complex arguments as well (such as hover_data).

For example, running the code below resulted in ValueError: Value of 'hover_data_0' is not the name of a column in 'data_frame'. Expected one of ['petal_length', 'sepal_length'] but received: species

import numpy as np
import plotly.express as px
import polars as pl

df = px.data.iris()
px.scatter(
    pl.from_pandas(df),
    x="petal_length",
    y="sepal_length",
    hover_data=["species"],  # <-- this was unsupported
)
  • 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).

@alexcjohnson
Copy link
Contributor

Thanks so much @guyrosin ! Would you add a changelog entry, in a new ## UNRELEASED section at the top? Then I think this is ready to go, and we'll try to get a patch out shortly.

@guyrosin
Copy link
Contributor Author

guyrosin commented Aug 15, 2023

Done. That's great to hear! Thanks @alexcjohnson for the feedback

Copy link
Contributor

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

💃 Very nice! Thanks again for identifying AND fixing this regression @guyrosin

@alexcjohnson alexcjohnson merged commit 402c9b4 into plotly:master Aug 15, 2023
4 checks passed
@guyrosin guyrosin deleted the fix-necessary-columns branch August 23, 2023 11:14
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.

None yet

2 participants