Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,25 @@ df['Original Issue Year'] = df['Original Issue Date'].dt.year
|
|
| 43 |
# else:
|
| 44 |
# st.write("No data available for the 'License Status' plot.")
|
| 45 |
|
| 46 |
-
# Visualization 1: Pie chart of licenses by Status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
st.subheader("Licenses by Status")
|
| 48 |
category_counts = df['License Status'].value_counts().reset_index()
|
| 49 |
category_counts.columns = ['License Status', 'Count']
|
|
@@ -51,7 +69,8 @@ category_counts.columns = ['License Status', 'Count']
|
|
| 51 |
if not category_counts.empty:
|
| 52 |
chart1 = alt.Chart(category_counts).mark_arc().encode(
|
| 53 |
theta=alt.Theta(field="Count", type="quantitative", title="Number of Licenses"),
|
| 54 |
-
color=alt.Color(field="License Status", type="nominal", legend=
|
|
|
|
| 55 |
tooltip=['License Status', 'Count']
|
| 56 |
).properties(
|
| 57 |
width=400,
|
|
@@ -62,6 +81,7 @@ if not category_counts.empty:
|
|
| 62 |
else:
|
| 63 |
st.write("No data available for the 'License Status' plot.")
|
| 64 |
|
|
|
|
| 65 |
# Write-up for Visualization 1
|
| 66 |
st.write("""
|
| 67 |
**Licenses by Status**: This visualization highlights the distribution of licenses across different statuses.
|
|
|
|
| 43 |
# else:
|
| 44 |
# st.write("No data available for the 'License Status' plot.")
|
| 45 |
|
| 46 |
+
# # Visualization 1: Pie chart of licenses by Status
|
| 47 |
+
# st.subheader("Licenses by Status")
|
| 48 |
+
# category_counts = df['License Status'].value_counts().reset_index()
|
| 49 |
+
# category_counts.columns = ['License Status', 'Count']
|
| 50 |
+
|
| 51 |
+
# if not category_counts.empty:
|
| 52 |
+
# chart1 = alt.Chart(category_counts).mark_arc().encode(
|
| 53 |
+
# theta=alt.Theta(field="Count", type="quantitative", title="Number of Licenses"),
|
| 54 |
+
# color=alt.Color(field="License Status", type="nominal", legend=None),
|
| 55 |
+
# tooltip=['License Status', 'Count']
|
| 56 |
+
# ).properties(
|
| 57 |
+
# width=400,
|
| 58 |
+
# height=400,
|
| 59 |
+
# title="Licenses by Status"
|
| 60 |
+
# )
|
| 61 |
+
# st.altair_chart(chart1)
|
| 62 |
+
# else:
|
| 63 |
+
# st.write("No data available for the 'License Status' plot.")
|
| 64 |
+
# Visualization 1: Pie chart of licenses by Status with distinct colors and legend
|
| 65 |
st.subheader("Licenses by Status")
|
| 66 |
category_counts = df['License Status'].value_counts().reset_index()
|
| 67 |
category_counts.columns = ['License Status', 'Count']
|
|
|
|
| 69 |
if not category_counts.empty:
|
| 70 |
chart1 = alt.Chart(category_counts).mark_arc().encode(
|
| 71 |
theta=alt.Theta(field="Count", type="quantitative", title="Number of Licenses"),
|
| 72 |
+
color=alt.Color(field="License Status", type="nominal", legend=alt.Legend(title="License Status"),
|
| 73 |
+
scale=alt.Scale(scheme='category20')), # Distinct color scheme
|
| 74 |
tooltip=['License Status', 'Count']
|
| 75 |
).properties(
|
| 76 |
width=400,
|
|
|
|
| 81 |
else:
|
| 82 |
st.write("No data available for the 'License Status' plot.")
|
| 83 |
|
| 84 |
+
|
| 85 |
# Write-up for Visualization 1
|
| 86 |
st.write("""
|
| 87 |
**Licenses by Status**: This visualization highlights the distribution of licenses across different statuses.
|