plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Making Radar Charts: make_trace_kwargs uses df.append which has been deprecated in pandas 2.0

Open RoshnikRahat opened this issue 1 year ago • 4 comments

Hello,

While making a radar chart using code from the pIotly documentation

Relevant Code: fig = px.line_polar(df, r='max-age', theta='category', line_close=True) fig.update_traces(fill='toself')

I got the error: AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?

which came from the \plotly\express_core.py and the make_trace_kwargs() function, corresponding to line:

trace_data = trace_data.append(trace_data.iloc[0])

RoshnikRahat avatar Apr 19 '24 15:04 RoshnikRahat

Hi @RoshnikRahat Could you please share the full reproducible code with us?

Coding-with-Adam avatar Apr 19 '24 20:04 Coding-with-Adam

Experienced same issue, see example code from https://plotly.com/python/radar-chart/

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()

Changing line_close argument to false will fix error but leave line open.

phyto-cosmosis avatar Jun 01 '24 02:06 phyto-cosmosis

hi @phyto-cosmosis I get this result when I do line_close=False. You get something different?

image

Coding-with-Adam avatar Jun 21 '24 14:06 Coding-with-Adam

hi @phyto-cosmosis I get this result when I do line_close=False. You get something different?

image

Hi @Coding-with-Adam, yeah that’s what I get with set to false. Circumvents the error but has the obvious impact of line now not being closed.

The error when true: dependency issue? Pandas?

phyto-cosmosis avatar Jun 21 '24 21:06 phyto-cosmosis

hi @phyto-cosmosis I'm not getting this error: " 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?"

Can you share what version of Plotly and pandas you're using?

Coding-with-Adam avatar Jul 01 '24 15:07 Coding-with-Adam

Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

gvwilson avatar Jul 12 '24 00:07 gvwilson