Reputation: 21
please see the fast fully contained colab example https://colab.research.google.com/drive/1lzaw1AmYeJtrcPBxcPCZPyeiACvv4U1C?usp=sharing
input:
%%capture
!pip install --upgrade plotly
import pandas as pd
final = pd.read_csv("https://raw.githubusercontent.com/firmai/random-assets-two/master/test/file.csv")
final.head()
final.dtypes
import plotly.express as px
import numpy as np
typed = "In-sample"
fig = px.treemap(final, path=["Data","Acronym"], values=typed)
fig.show()
output:
[Blank]
Upvotes: 2
Views: 3160
Reputation: 2547
This issue might also be related to how you handle NaN as treemap will raise an error if a parent has NaN. I had this issue when filling NaN with ''. Was able to solve with df.fillna('NaN')
Upvotes: 0
Reputation: 31196
You are trying to plot too many items in the treemap.
fig = px.treemap(
final.loc[final[typed].ge(0)],
path=["Data", "Acronym"],
values=typed,
)
import pandas as pd
final = pd.read_csv(
"https://raw.githubusercontent.com/firmai/random-assets-two/master/test/file.csv"
)
final.head()
final.dtypes
import plotly.express as px
import numpy as np
typed = "In-sample"
fig = px.treemap(
final.loc[pd.qcut(final[typed], q=4, labels=[0, 1, 2, 3]).ge(2)],
path=["Data", "Acronym"],
values=typed,
)
fig
Upvotes: 1