Problem with Plotly-Express, Treemapchart


I’m having some trouble with plotly express.
In particular, I wrote a script for an interactive treemap chart and it worked fine until a couple of weeks ago. Unexpectedly and without applying any modification, it stopped working. Also, some Plotly example scripts do not work anymore on my machine.

For instance, if I run the following script:

import as px
df =
fig = px.treemap(df, path=['day', 'time', 'sex'], values='total_bill')

I get the following error:

AttributeError: type object 'object' has no attribute 'dtype'

My script is very similar to this default example, although my dataframe has some None value.
I speculate that the problem relates to the ‘path’ since the errors disappear if I run alternative code without this argument. How can I fix the issue?


PS. Sorry for the ‘stupid’ question, I’m rather new to Pyhon programming

If it was working fine before it maybe a version problem, can you check what version of plotly is installed on your system?

I have installed plotly 4.14.1 and pandas 0.25.3

Okay then its probably due to those None values in your dataframe. I think it is similar to this thread.