Update app.py
Browse files
app.py
CHANGED
@@ -55,6 +55,21 @@ for uploaded_file in uploaded_files:
|
|
55 |
st.write(uploaded_file.getbuffer().readonly)
|
56 |
st.write(uploaded_file.getbuffer().c_contiguous)
|
57 |
st.write(uploaded_file.getbuffer().f_contiguous)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
|
60 |
#show replace
|
@@ -212,6 +227,4 @@ fig = px.treemap(df, path=[px.Constant("ROOTS"), 'Macroarea', 'Family', 'Genus',
|
|
212 |
fig.update_traces(root_color="pink")
|
213 |
fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
|
214 |
|
215 |
-
st.plotly_chart(fig, use_container_width=True)
|
216 |
-
|
217 |
-
|
|
|
55 |
st.write(uploaded_file.getbuffer().readonly)
|
56 |
st.write(uploaded_file.getbuffer().c_contiguous)
|
57 |
st.write(uploaded_file.getbuffer().f_contiguous)
|
58 |
+
myDF = pd.DataFrame(uploaded_file.getbuffer().tolist())
|
59 |
+
|
60 |
+
|
61 |
+
st.markdown("# Treemaps from upload data file: https://plotly.com/python/treemaps/")
|
62 |
+
#df = myDF.query("year == 2007")
|
63 |
+
df = myDF
|
64 |
+
fig = px.treemap(df, path=[px.Constant("time"), 'message', 'name'], values='content',
|
65 |
+
color='lifeExp', hover_data=['iso_alpha'],
|
66 |
+
color_continuous_scale='RdBu',
|
67 |
+
color_continuous_midpoint=np.average(df['name'], weights=df['content'])) # todo - debug this and get it working with the data
|
68 |
+
fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
|
69 |
+
#fig.show()
|
70 |
+
st.plotly_chart(fig, use_container_width=True)
|
71 |
+
|
72 |
+
|
73 |
|
74 |
|
75 |
#show replace
|
|
|
227 |
fig.update_traces(root_color="pink")
|
228 |
fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
|
229 |
|
230 |
+
st.plotly_chart(fig, use_container_width=True)
|
|
|
|