Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,15 @@ login(token = os.environ['hf_token'])
|
|
17 |
dataset = load_dataset("irfantea/collections", data_files='Kombinasi.csv', split='train')
|
18 |
df = dataset.to_pandas()
|
19 |
|
20 |
-
|
21 |
def load_data():
|
|
|
22 |
df["First name"] = df["First name"].astype("string")
|
23 |
df["Grade/100.00 (Simulasi)"] = df["Grade/100.00 (Simulasi)"].astype(float)
|
24 |
df["Grade/100.00 (Ujian 1)"] = df["Grade/100.00 (Ujian 1)"].astype(float)
|
25 |
-
df["
|
|
|
|
|
26 |
return df
|
27 |
|
28 |
df = load_data()
|
@@ -30,9 +33,8 @@ df = load_data()
|
|
30 |
def cari_npm(npm):
|
31 |
df_cari = df[df["First name"] == npm]
|
32 |
return df_cari
|
33 |
-
|
34 |
def susun_data(data_npm):
|
35 |
-
columns_to_display = ["Surname", "First name", "Grade/100.00 (Ujian 1)", "
|
36 |
st.table(data_npm[columns_to_display])
|
37 |
|
38 |
colors = ['red', 'green', 'blue']
|
@@ -57,9 +59,36 @@ with kolom1:
|
|
57 |
plt.xlabel('Rentang')
|
58 |
plt.ylabel('Jumlah Mahasiswa')
|
59 |
st.pyplot(plt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
with kolom3:
|
65 |
st.write("Ujian Final")
|
|
|
17 |
dataset = load_dataset("irfantea/collections", data_files='Kombinasi.csv', split='train')
|
18 |
df = dataset.to_pandas()
|
19 |
|
20 |
+
#@st.cache_data
|
21 |
def load_data():
|
22 |
+
df = pd.read_csv("Kombinasi.csv")
|
23 |
df["First name"] = df["First name"].astype("string")
|
24 |
df["Grade/100.00 (Simulasi)"] = df["Grade/100.00 (Simulasi)"].astype(float)
|
25 |
df["Grade/100.00 (Ujian 1)"] = df["Grade/100.00 (Ujian 1)"].astype(float)
|
26 |
+
df["Grade/100.00 (Ujian 2)"] = df["Grade/100.00 (Ujian 2)"].astype(float)
|
27 |
+
df["Ujian 1 (15%)"] = (df["Grade/100.00 (Ujian 1)"].astype(float) * 0.15).round(2)
|
28 |
+
df["Ujian 2 (30%)"] = (df["Grade/100.00 (Ujian 2)"].astype(float) * 0.30).round(2)
|
29 |
return df
|
30 |
|
31 |
df = load_data()
|
|
|
33 |
def cari_npm(npm):
|
34 |
df_cari = df[df["First name"] == npm]
|
35 |
return df_cari
|
|
|
36 |
def susun_data(data_npm):
|
37 |
+
columns_to_display = ["Surname", "First name", "Grade/100.00 (Ujian 1)", "Ujian 1 (15%)", "Grade/100.00 (Ujian 2)", "Ujian 2 (30%)"]
|
38 |
st.table(data_npm[columns_to_display])
|
39 |
|
40 |
colors = ['red', 'green', 'blue']
|
|
|
59 |
plt.xlabel('Rentang')
|
60 |
plt.ylabel('Jumlah Mahasiswa')
|
61 |
st.pyplot(plt)
|
62 |
+
average = df["Grade/100.00 (Ujian 1)"].mean()
|
63 |
+
median = df["Grade/100.00 (Ujian 1)"].median()
|
64 |
+
stdev = df["Grade/100.00 (Ujian 1)"].std()
|
65 |
+
st.info("Mean: " + str(average))
|
66 |
+
st.info("Median: " + str(median))
|
67 |
+
st.info("STDev: " + str(stdev))
|
68 |
+
|
69 |
+
with kolom2:
|
70 |
+
grades = df["Grade/100.00 (Ujian 2)"]
|
71 |
+
count_below_50 = (grades < 50).sum()
|
72 |
+
count_50_to_68 = ((grades >= 50) & (grades <= 68)).sum()
|
73 |
+
count_above_68 = (grades > 68).sum()
|
74 |
|
75 |
+
data = {
|
76 |
+
'Category': ['Below 50', '50 - 68', 'Above 68'],
|
77 |
+
'Count': [count_below_50, count_50_to_68, count_above_68]
|
78 |
+
}
|
79 |
+
df_counts = pd.DataFrame(data)
|
80 |
+
st.write("Ujian 2")
|
81 |
+
plt.clf() # Clear the current figure
|
82 |
+
plt.bar(df_counts['Category'], df_counts['Count'], color=colors)
|
83 |
+
plt.xlabel('Rentang')
|
84 |
+
plt.ylabel('Jumlah Mahasiswa')
|
85 |
+
st.pyplot(plt)
|
86 |
+
average = df["Grade/100.00 (Ujian 2)"].mean()
|
87 |
+
median = df["Grade/100.00 (Ujian 2)"].median()
|
88 |
+
stdev = df["Grade/100.00 (Ujian 2)"].std()
|
89 |
+
st.info("Mean: " + str(average))
|
90 |
+
st.info("Median: " + str(median))
|
91 |
+
st.info("STDev: " + str(stdev))
|
92 |
|
93 |
with kolom3:
|
94 |
st.write("Ujian Final")
|