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

treemap AttributeError: 'DataFrame' object has no attribute 'append' #4761

Open
StepanSushko opened this issue Sep 11, 2024 · 0 comments
Open
Labels
bug something broken P2 needed for current cycle

Comments

@StepanSushko
Copy link

I try to run this code of the example from the guide page

import plotly.express as px
df = px.data.tips()
fig = px.treemap(df, path=[px.Constant("all"), 'sex', 'day', 'time'],
                 values='total_bill', color='time')
fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
fig.show()

but it just gives an error


File ...\Python310\lib\site-packages\plotly\express\_core.py:1637, in process_dataframe_hierarchy(args)
   [1635](.../Python310/lib/site-packages/plotly/express/_core.py:1635)     if cols:
   [1636](.../Python310/lib/site-packages/plotly/express/_core.py:1636)         df_tree[cols] = dfg[cols]
-> [1637](.../Python310/lib/site-packages/plotly/express/_core.py:1637)     df_all_trees = df_all_trees.append(df_tree, ignore_index=True)
   [1639](.../Python310/lib/site-packages/plotly/express/_core.py:1639) # we want to make sure than (?) is the first color of the sequence
   [1640](.../Python310/lib/site-packages/plotly/express/_core.py:1640) if args["color"] and discrete_color:

File c:\Users\stepa\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\core\generic.py:5989, in NDFrame.__getattr__(self, name)
   [5982](.../Python310/lib/site-packages/pandas/core/generic.py:5982) if (
   [5983](.../Python310/lib/site-packages/pandas/core/generic.py:5983)     name not in self._internal_names_set
   [5984](.../Python310/lib/site-packages/pandas/core/generic.py:5984)     and name not in self._metadata
   [5985](../Python310/lib/site-packages/pandas/core/generic.py:5985)     and name not in self._accessors
   [5986](.../Python310/lib/site-packages/pandas/core/generic.py:5986)     and self._info_axis._can_hold_identifiers_and_holds_name(name)
   [5987](.../Python310/lib/site-packages/pandas/core/generic.py:5987) ):
   [5988](.../Python310/lib/site-packages/pandas/core/generic.py:5988)     return self[name]
-> [5989](.../Python310/lib/site-packages/pandas/core/generic.py:5989) return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'append'

pandas=2.2.2
plotly.express=0.4.1
plotly=5.24.0

@gvwilson gvwilson added bug something broken P2 needed for current cycle labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P2 needed for current cycle
Projects
None yet
Development

No branches or pull requests

2 participants