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

Update docs dependencies and Python version #4596

Merged
merged 17 commits into from May 13, 2024
Merged

Conversation

LiamConnors
Copy link
Contributor

@LiamConnors LiamConnors commented May 1, 2024

This PR:

To close #4491

@LiamConnors LiamConnors marked this pull request as ready for review May 1, 2024 17:46
@@ -305,7 +305,7 @@ def build_hierarchical_dataframe(df, levels, value_column, color_columns=None):
Levels are given starting from the bottom to the top of the hierarchy,
ie the last level corresponds to the root.
"""
df_all_trees = pd.DataFrame(columns=['id', 'parent', 'value', 'color'])
df_trees = []
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this change but I'm willing to take it on faith :-)

Copy link
Contributor

@emilykl emilykl May 6, 2024

Choose a reason for hiding this comment

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

@LiamConnors My only suggestion here (and at the other spot) is that the df_trees variable be renamed to clarify that it's a list of dfs rather than a df.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sorry, I should have given more context.

The original example uses df.append, to append each new dataframe in the loop to the first dataframe, but that method was removed.

So here I instead use a list, and add each to a list and use pd.concat on the list instead.

We had to make this update also in the plotly.express library itself at one stage and that's the approach we took: #4190

@emilykl good suggestion. Will update the variable name
pd.concat has existed at least since https://pandas.pydata.org/pandas-docs/version/0.13/generated/pandas.concat.html

@@ -355,7 +355,7 @@ def build_hierarchical_dataframe(df, levels, value_column, color_columns=None):
Levels are given starting from the bottom to the top of the hierarchy,
ie the last level corresponds to the root.
"""
df_all_trees = pd.DataFrame(columns=['id', 'parent', 'value', 'color'])
df_trees = []
Copy link
Contributor

Choose a reason for hiding this comment

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

again, I don't understand this change but am willing to trust you.

@@ -316,7 +316,7 @@ def build_hierarchical_dataframe(df, levels, value_column, color_columns=None):
Levels are given starting from the bottom to the top of the hierarchy,
ie the last level corresponds to the root.
"""
df_all_trees = pd.DataFrame(columns=['id', 'parent', 'value', 'color'])
df_trees = []
Copy link
Contributor

Choose a reason for hiding this comment

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

as above...

Copy link
Contributor

@gvwilson gvwilson left a comment

Choose a reason for hiding this comment

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

There are three places where it appears that a single call to Pandas has been replaced by a loop. I don't have enough context to understand the change but am willing to take it on faith; would be happy to discuss.

@emilykl
Copy link
Contributor

emilykl commented May 6, 2024

@LiamConnors Are the Pandas example code changes still backwards-compatible with Pandas 1.x?

@LiamConnors LiamConnors merged commit 1fef3ee into master May 13, 2024
5 checks passed
@LiamConnors LiamConnors deleted the update-docs-build branch May 13, 2024 14:31
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.

Update all docs examples to run on Python 3.10 with later libraries
3 participants