Update app.py
Browse files
app.py
CHANGED
@@ -104,16 +104,17 @@ if upload_file is not None:
|
|
104 |
value_column = st.selectbox("Select the value column:", all_columns)
|
105 |
|
106 |
if parent_column and value_column:
|
|
|
|
|
|
|
107 |
path_columns = [px.Constant("all"), parent_column, value_column]
|
108 |
-
|
109 |
fig = px.treemap(df,
|
110 |
-
|
111 |
-
|
112 |
fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
|
113 |
st.subheader("Tree map", divider="red")
|
114 |
st.plotly_chart(fig)
|
115 |
-
|
116 |
-
|
117 |
st.write("_number of rows_", df.shape[0])
|
118 |
st.write("_number of columns_", df.shape[1])
|
119 |
st.session_state.df = df
|
|
|
104 |
value_column = st.selectbox("Select the value column:", all_columns)
|
105 |
|
106 |
if parent_column and value_column:
|
107 |
+
if parent_column == value_column:
|
108 |
+
st.warning("Warning: You have selected the same column for both the parent and value. This might not produce a meaningful treemap.")
|
109 |
+
elif parent_column and value_column:
|
110 |
path_columns = [px.Constant("all"), parent_column, value_column]
|
|
|
111 |
fig = px.treemap(df,
|
112 |
+
path=path_columns)
|
113 |
+
|
114 |
fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
|
115 |
st.subheader("Tree map", divider="red")
|
116 |
st.plotly_chart(fig)
|
117 |
+
|
|
|
118 |
st.write("_number of rows_", df.shape[0])
|
119 |
st.write("_number of columns_", df.shape[1])
|
120 |
st.session_state.df = df
|