How is there no attribute "pie"

import plotly.express as px

h_town = nba[(nba[‘Tm’]==‘HOU’)]
fig = px.pie(h_town, values=‘PTS’, names=‘Player’,
title=‘Houston Rockets: Player Point Distribution’,
hover_data=[‘MP’], labels={‘MP’:‘Minutes Played’})
fig.update_traces(textposition=‘inside’, textinfo=‘percent+label’)
fig.show()

AttributeError: module ‘plotly.express’ has no attribute ‘pie’

hi @wsr4myr, for px.pie you need to install/update to latest version of plotly 4.4.1, which was released on Tuesday and announced on the forum 15 minutes ago :-).

Thank you @Emmanuelle!

Hi @Emmanuelle,

I have upgraded the plotly to the latest version 4.5.4, but I still get the same error of:
AttributeError: module ‘plotly.express’ has no attribute ‘pie’

Hi @Sophie welcome to the forum! This is weird, are you completely sure that you are getting this error with plotly 4.5.4? To be sure, can you please execute the following commands

import plotly
print(plotly.__version__)
import plotly.express as px
fig = px.pie(values=[1, 2, 3])
fig.show()

and post here the result?

1 Like

Hi @Emmanuelle,

Thanks for the tips! It actually worked with your codes! I need to import plotly before I import plotly.express!

Thanks and all the best,
Sophie