faizhalas commited on
Commit
e9ccc04
·
verified ·
1 Parent(s): b335ce3

Update Home.py

Browse files
Files changed (1) hide show
  1. Home.py +68 -1
Home.py CHANGED
@@ -4,6 +4,8 @@ import pandas as pd
4
  import numpy as np
5
  import re
6
  from eldar import Query
 
 
7
 
8
 
9
  #===config===
@@ -137,7 +139,72 @@ try:
137
  btn4.link_button("Sumber", scholar_url, icon="🌐")
138
 
139
  else:
140
- st.write("Dalam pembangunan")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
  except Exception as e:
143
  st.write(e)
 
4
  import numpy as np
5
  import re
6
  from eldar import Query
7
+ import altair as alt
8
+
9
 
10
 
11
  #===config===
 
139
  btn4.link_button("Sumber", scholar_url, icon="🌐")
140
 
141
  else:
142
+ st.write("Jurnal")
143
+ jrnl_counts = df["Journal"].value_counts().sort_index()
144
+ jrnl_counts_df = pd.DataFrame({"Journal": jrnl.index, "Count": jrnl.values})
145
+ jrnl_counts_df = jrnl_counts_df.set_index("Journal")
146
+
147
+ # Display bar chart
148
+ st.bar_chart(jrnl_counts_df)
149
+
150
+ st.write("Tahun")
151
+ year_counts = df["Year"].value_counts().sort_index()
152
+ year_counts_df = pd.DataFrame({"Year": year_counts.index, "Count": year_counts.values})
153
+ year_counts_df = year_counts_df.set_index("Year")
154
+
155
+ # Display bar chart
156
+ st.bar_chart(year_counts_df)
157
+
158
+ institutions = (
159
+ key_df_j["Institution"]
160
+ .str.split(",") # split by comma
161
+ .explode() # expand into rows
162
+ .str.strip() # remove extra spaces
163
+ )
164
+
165
+ st.write("Institusi")
166
+ # Count occurrences
167
+ inst_counts = institutions.value_counts().reset_index()
168
+ inst_counts.columns = ["Institution", "Count"]
169
+
170
+ # Horizontal bar chart with Altair
171
+ chart_ins = (
172
+ alt.Chart(inst_counts)
173
+ .mark_bar()
174
+ .encode(
175
+ x="Count:Q",
176
+ y=alt.Y("Institution:N", sort='-x') # sort descending
177
+ )
178
+ )
179
+
180
+ st.altair_chart(chart_ins, use_container_width=True)
181
+
182
+
183
+ author = (
184
+ key_df_j["Authors"]
185
+ .str.split(",") # split by comma
186
+ .explode() # expand into rows
187
+ .str.strip() # remove extra spaces
188
+ )
189
+
190
+ st.write("Author")
191
+ # Count occurrences
192
+ aut_counts = aut.value_counts().reset_index()
193
+ aut_counts.columns = ["Authors", "Count"]
194
+
195
+ # Horizontal bar chart with Altair
196
+ chart_aut = (
197
+ alt.Chart(inst_counts)
198
+ .mark_bar()
199
+ .encode(
200
+ x="Count:Q",
201
+ y=alt.Y("Authors:N", sort='-x') # sort descending
202
+ )
203
+ )
204
+
205
+ st.altair_chart(chart_aut, use_container_width=True)
206
+
207
+
208
 
209
  except Exception as e:
210
  st.write(e)