Hello all,
Here is a sample of the dataset I am using in Jupyter Notebook, Python 3.8;
d = {"deed_date":{"0":1546473600000,"1":1546560000000,"2":1546819200000,"3":1546992000000,"4":1547078400000},"year":{"0":2019,"1":2019,"2":2019,"3":2019,"4":2019},"month":{"0":1,"1":1,"2":1,"3":1,"4":1},"day":{"0":3,"1":4,"2":7,"3":9,"4":10},"trans_count":{"0":3.0,"1":19.0,"2":1.0,"3":4.0,"4":6.0},"district":{"0":"Barking And Dagenham","1":"Barking And Dagenham","2":"Barking And Dagenham","3":"Barking And Dagenham","4":"Barking And Dagenham"},"month_n":{"0":"January","1":"January","2":"January","3":"January","4":"January"},"day_n":{"0":"Thursday","1":"Friday","2":"Monday","3":"Wednesday","4":"Thursday"}}
Which, whilst I have successfully created what I want in plotly express (see next code)
lr_borough_time = pd.DataFrame(data=d)
data = px.treemap(
data_frame=lr_borough_time,
path=['year','month_n', 'day_n'],
values=lr_borough_time['trans_count'],
title="Total transactions count by Year, Month, Day. Order and size correspond to number of transactions.",
hover_data=['trans_count']
)
fig = go.Figure(data=data)
fig.update_layout(treemapcolorway=['lightgrey', 'lightblue'])
pyo.plot(fig)
However when trying to utilise it in graph_objs.Treemap (I want greater control over the chart and am more familiar with go than px) it simply doesn’t render. Gives no error. Here is my code.
data = go.Treemap(
branchvalues='total',
labels=lr_borough_time['month_n'],
parents=lr_borough_time['day_n'],
values=lr_borough_time['trans_count']
)
fig = go.Figure(data=data)
fig.show()
I have googled this and saw bug fixes in streamlit but I’m not using it.
Any help would be appreciated!
Thanks.