Spaces:
Sleeping
Sleeping
Ezhil
commited on
Commit
·
c97cf0f
1
Parent(s):
aa131a7
Changes DV - network analysis-4
Browse files
functions/visualizations.py
CHANGED
|
@@ -451,6 +451,9 @@ def generate_network_analysis(df):
|
|
| 451 |
st.header("Network Analysis")
|
| 452 |
tab1, tab2 = st.tabs(["Artist Collaborations", "Genre Crossover"])
|
| 453 |
|
|
|
|
|
|
|
|
|
|
| 454 |
with tab1:
|
| 455 |
st.markdown("**Top Collaborating Artists:** Shows which artists collaborate the most.")
|
| 456 |
if 'Artists' in df.columns:
|
|
@@ -469,7 +472,7 @@ def generate_network_analysis(df):
|
|
| 469 |
|
| 470 |
st.pyplot(fig)
|
| 471 |
else:
|
| 472 |
-
st.error("Cannot plot: 'Artists' column missing.")
|
| 473 |
|
| 474 |
with tab2:
|
| 475 |
st.markdown("**Genre Crossover:** Shows relationships between genres using a stacked bar chart.")
|
|
@@ -501,4 +504,5 @@ def generate_network_analysis(df):
|
|
| 501 |
|
| 502 |
st.pyplot(fig)
|
| 503 |
else:
|
| 504 |
-
st.error("Cannot plot: 'Genres' column missing.")
|
|
|
|
|
|
| 451 |
st.header("Network Analysis")
|
| 452 |
tab1, tab2 = st.tabs(["Artist Collaborations", "Genre Crossover"])
|
| 453 |
|
| 454 |
+
# Ensure column names are stripped of spaces
|
| 455 |
+
df.columns = df.columns.str.strip()
|
| 456 |
+
|
| 457 |
with tab1:
|
| 458 |
st.markdown("**Top Collaborating Artists:** Shows which artists collaborate the most.")
|
| 459 |
if 'Artists' in df.columns:
|
|
|
|
| 472 |
|
| 473 |
st.pyplot(fig)
|
| 474 |
else:
|
| 475 |
+
st.error("Cannot plot: 'Artists' column missing. Available columns: " + ", ".join(df.columns))
|
| 476 |
|
| 477 |
with tab2:
|
| 478 |
st.markdown("**Genre Crossover:** Shows relationships between genres using a stacked bar chart.")
|
|
|
|
| 504 |
|
| 505 |
st.pyplot(fig)
|
| 506 |
else:
|
| 507 |
+
st.error("Cannot plot: 'Genres' column missing. Available columns: " + ", ".join(df.columns))
|
| 508 |
+
|