Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,29 +43,31 @@ st.write("Column Data Types:", df.dtypes)
|
|
| 43 |
# for col in df.select_dtypes(include='object').columns:
|
| 44 |
# df[col] = df[col].astype('category')
|
| 45 |
|
| 46 |
-
# Visualization 1:
|
| 47 |
-
st.subheader("Licenses by Type")
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
|
|
|
| 53 |
x=alt.X('License Type', sort='-y', title='License Type'),
|
| 54 |
y=alt.Y('Count', title='Number of Licenses'),
|
| 55 |
-
color=alt.Color('License
|
|
|
|
| 56 |
).properties(
|
| 57 |
-
width=
|
| 58 |
height=400,
|
| 59 |
-
title="Number of Licenses by Type"
|
| 60 |
-
)
|
|
|
|
| 61 |
st.altair_chart(chart1)
|
| 62 |
|
| 63 |
# Write-up for Visualization 1
|
| 64 |
st.write("""
|
| 65 |
-
**Licenses by Type**: This visualization
|
| 66 |
-
The
|
| 67 |
-
|
| 68 |
-
If I had more time, I might add interactivity to allow users to filter by other variables.
|
| 69 |
""")
|
| 70 |
|
| 71 |
# Visualization 2: Line chart showing licenses issued over time
|
|
|
|
| 43 |
# for col in df.select_dtypes(include='object').columns:
|
| 44 |
# df[col] = df[col].astype('category')
|
| 45 |
|
| 46 |
+
# Visualization 1: Licenses by Type with License Status breakdown
|
| 47 |
+
st.subheader("Licenses by Type and Status")
|
| 48 |
|
| 49 |
+
# Group data by License Type and License Status
|
| 50 |
+
category_status_counts = df.groupby(['License Type', 'License Status']).size().reset_index(name='Count')
|
| 51 |
|
| 52 |
+
# Create a bar chart with color representing License Status
|
| 53 |
+
chart1 = alt.Chart(category_status_counts).mark_bar().encode(
|
| 54 |
x=alt.X('License Type', sort='-y', title='License Type'),
|
| 55 |
y=alt.Y('Count', title='Number of Licenses'),
|
| 56 |
+
color=alt.Color('License Status', legend=alt.Legend(title="License Status")),
|
| 57 |
+
tooltip=['License Type', 'License Status', 'Count']
|
| 58 |
).properties(
|
| 59 |
+
width=700,
|
| 60 |
height=400,
|
| 61 |
+
title="Number of Licenses by Type and Status"
|
| 62 |
+
).interactive()
|
| 63 |
+
|
| 64 |
st.altair_chart(chart1)
|
| 65 |
|
| 66 |
# Write-up for Visualization 1
|
| 67 |
st.write("""
|
| 68 |
+
**Licenses by Type and Status**: This visualization shows the distribution of licenses across different types with further breakdown by license status.
|
| 69 |
+
The interactive chart allows users to view counts for each license status (e.g., active, inactive) within each license type.
|
| 70 |
+
This breakdown can help identify how license types vary not only in volume but also in the proportion of active versus inactive licenses.If I had more time, I might add interactivity to allow users to filter by other variables.
|
|
|
|
| 71 |
""")
|
| 72 |
|
| 73 |
# Visualization 2: Line chart showing licenses issued over time
|