Skip to content

Plotly.express not working with Pandas Dataframe #4179

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

Closed
JS-Aibel opened this issue Apr 28, 2023 · 2 comments · Fixed by #4190
Closed

Plotly.express not working with Pandas Dataframe #4179

JS-Aibel opened this issue Apr 28, 2023 · 2 comments · Fixed by #4190

Comments

@JS-Aibel
Copy link

The example below results in an error message saying “AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?”. The plotly example is taken from https://plotly.com/python/radar-chart/.
Running Plotly Version: 5.14.1 and Pandas Version: 2.0.1.

import plotly.express as px
import pandas as pd
df = pd.DataFrame(dict(
    r=[1, 5, 2, 2, 3],
    theta=['processing cost','mechanical properties','chemical stability',
           'thermal stability', 'device integration']))
fig = px.line_polar(df, r='r', theta='theta', line_close=True)
fig.show()
@Tauvic
Copy link

Tauvic commented Apr 29, 2023

Yes got the same issue. Running Plotly Version: 5.14.1 and Pandas Version: 2.0.1.

2023-04-29 17:09:37.289 Uncaught app exception
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/app/resumebuilderapp/pages/3_Summary.py", line 84, in
fig = px.line_polar(d, r='years', theta='expertise',color='proficiency',
File "/home/appuser/venv/lib/python3.9/site-packages/plotly/express/_chart_types.py", line 998, in line_polar
return make_figure(args=locals(), constructor=go.Scatterpolar)
File "/home/appuser/venv/lib/python3.9/site-packages/plotly/express/_core.py", line 2173, in make_figure
patch, fit_results = make_trace_kwargs(
File "/home/appuser/venv/lib/python3.9/site-packages/plotly/express/_core.py", line 271, in make_trace_kwargs
trace_data = trace_data.append(trace_data.iloc[0])
File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/generic.py", line 5989, in getattr
return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'append'

@Satoshi-Sh
Copy link

Same here. Seems like the append function was depreciated, and it needs to be replaced by concat.

@alexcjohnson alexcjohnson mentioned this issue May 5, 2023
3 tasks
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 a pull request may close this issue.

3 participants