Skip to content

[Easy fix] plotly/express/_core.py:271 FutureWarning #4065

Closed
@Getslow6

Description

@Getslow6

Hi all,

I've got an online Jupyter notebook where I came across this error, but not sure how to fix and test this bug. I think it might be an easy fix:

/usr/local/lib/python3.9/dist-packages/plotly/express/_core.py:271: FutureWarning:

The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

Example code to reproduce the issue:

df = pd.DataFrame({'Weekday': ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Thursday', 'Sunday'],
                   'Temperature': [10., 12., 14., 16., 12., 14., 16., 12., 14., 16.]})

temperatures = df.groupby('Weekday', as_index=False)['Temperature'].mean()
fig = px.line_polar(temperatures, r='Temperature', theta='Weekday', line_close=True)
fig.show()

The code that needs to be changed can be found here, on line 271:
https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/express/_core.py

I think the change will need to be:
trace_data = trace_data.append(trace_data.iloc[0]) to trace_data = pd.concat([trace_data, trace_data.iloc[0]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions