ralate2 commited on
Commit
34e64a7
·
verified ·
1 Parent(s): 841fdef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -7
app.py CHANGED
@@ -24,20 +24,39 @@ df.dropna(subset=['License Type', 'License Status', 'Original Issue Date'], inpl
24
  # Add Year columns for visualizations
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',scale=alt.Scale(domain=(0, 600), nice=False)),
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:
 
24
  # Add Year columns for visualizations
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',scale=alt.Scale(domain=(0, 600), nice=False)),
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
+ # 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: