Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,34 +25,14 @@ df.dropna(subset=['License Type', 'License Status', 'Original Issue Date'], inpl
|
|
| 25 |
df['Original Issue Year'] = df['Original Issue Date'].dt.year
|
| 26 |
|
| 27 |
# Visualization 1: Bar chart of licenses by Status
|
| 28 |
-
# st.subheader("Licenses by Status")
|
| 29 |
-
# category_counts = df['License Status'].value_counts().reset_index()
|
| 30 |
-
# category_counts.columns = ['License Status', 'Count']
|
| 31 |
-
|
| 32 |
-
# if not category_counts.empty:
|
| 33 |
-
# chart1 = alt.Chart(category_counts).mark_bar().encode(
|
| 34 |
-
# x=alt.X('License Status', sort='-y', title='License Type'),
|
| 35 |
-
# y=alt.Y('Count', title='Number of Licenses'),
|
| 36 |
-
# color=alt.Color('License Status', legend=None)
|
| 37 |
-
# ).properties(
|
| 38 |
-
# width=600,
|
| 39 |
-
# height=400,
|
| 40 |
-
# title="Number of Licenses by Status"
|
| 41 |
-
# )
|
| 42 |
-
# st.altair_chart(chart1)
|
| 43 |
-
# else:
|
| 44 |
-
# st.write("No data available for the 'License Status' plot.")
|
| 45 |
-
|
| 46 |
st.subheader("Licenses by Status")
|
| 47 |
category_counts = df['License Status'].value_counts().reset_index()
|
| 48 |
category_counts.columns = ['License Status', 'Count']
|
| 49 |
|
| 50 |
if not category_counts.empty:
|
| 51 |
-
# Set Y-axis domain with 10% padding above the max count if below 100, else dynamic
|
| 52 |
-
y_max = min(100, category_counts['Count'].max() * 1.1)
|
| 53 |
chart1 = alt.Chart(category_counts).mark_bar().encode(
|
| 54 |
x=alt.X('License Status', sort='-y', title='License Type'),
|
| 55 |
-
y=alt.Y('Count', title='Number of Licenses'
|
| 56 |
color=alt.Color('License Status', legend=None)
|
| 57 |
).properties(
|
| 58 |
width=600,
|
|
@@ -63,7 +43,6 @@ if not category_counts.empty:
|
|
| 63 |
else:
|
| 64 |
st.write("No data available for the 'License Status' plot.")
|
| 65 |
|
| 66 |
-
|
| 67 |
# Write-up for Visualization 1
|
| 68 |
st.write("""
|
| 69 |
**Licenses by Status**: This visualization highlights the distribution of licenses across different statuses.
|
|
|
|
| 25 |
df['Original Issue Year'] = df['Original Issue Date'].dt.year
|
| 26 |
|
| 27 |
# Visualization 1: Bar chart of licenses by Status
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
st.subheader("Licenses by Status")
|
| 29 |
category_counts = df['License Status'].value_counts().reset_index()
|
| 30 |
category_counts.columns = ['License Status', 'Count']
|
| 31 |
|
| 32 |
if not category_counts.empty:
|
|
|
|
|
|
|
| 33 |
chart1 = alt.Chart(category_counts).mark_bar().encode(
|
| 34 |
x=alt.X('License Status', sort='-y', title='License Type'),
|
| 35 |
+
y=alt.Y('Count', title='Number of Licenses'),
|
| 36 |
color=alt.Color('License Status', legend=None)
|
| 37 |
).properties(
|
| 38 |
width=600,
|
|
|
|
| 43 |
else:
|
| 44 |
st.write("No data available for the 'License Status' plot.")
|
| 45 |
|
|
|
|
| 46 |
# Write-up for Visualization 1
|
| 47 |
st.write("""
|
| 48 |
**Licenses by Status**: This visualization highlights the distribution of licenses across different statuses.
|