Spaces:
Runtime error
Runtime error
Commit
·
4a4533c
1
Parent(s):
57a7ac5
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,16 +18,13 @@ if uploaded_file is not None:
|
|
| 18 |
# Generate a treemap or sunburst plot based on data types
|
| 19 |
numerical_cols = df.select_dtypes(include=["float", "int"]).columns
|
| 20 |
categorical_cols = df.select_dtypes(include=["object"]).columns
|
| 21 |
-
|
| 22 |
-
fig = px.treemap(df, path=categorical_cols)
|
| 23 |
-
st.plotly_chart(fig)
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
| 18 |
# Generate a treemap or sunburst plot based on data types
|
| 19 |
numerical_cols = df.select_dtypes(include=["float", "int"]).columns
|
| 20 |
categorical_cols = df.select_dtypes(include=["object"]).columns
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
if len(numerical_cols) >= 2:
|
| 23 |
+
fig = px.scatter_matrix(df, dimensions=numerical_cols)
|
| 24 |
+
st.plotly_chart(fig)
|
| 25 |
+
elif len(categorical_cols) >= 2:
|
| 26 |
+
fig = px.treemap(df, path=categorical_cols)
|
| 27 |
+
st.plotly_chart(fig)
|
| 28 |
+
else:
|
| 29 |
+
fig = px.sunburst(df, path=categorical_cols + numerical_cols)
|
| 30 |
+
st.plotly_chart(fig)
|