Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +65 -0
- requirements.txt +53 -0
app.py
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
+
|
5 |
+
st.set_page_config(
|
6 |
+
page_title="Daftar Nilai Assesmen 1",
|
7 |
+
page_icon="chart_with_upwards_trend",
|
8 |
+
layout="wide",
|
9 |
+
)
|
10 |
+
|
11 |
+
@st.cache_data
|
12 |
+
def load_data():
|
13 |
+
df = pd.read_csv("Kombinasi.csv")
|
14 |
+
df["First name"] = df["First name"].astype("string")
|
15 |
+
df["Grade/100.00 (Simulasi)"] = df["Grade/100.00 (Simulasi)"].astype(float)
|
16 |
+
df["Grade/100.00 (Ujian 1)"] = df["Grade/100.00 (Ujian 1)"].astype(float)
|
17 |
+
df["Persentase Ujian 1 (15%)"] = (df["Grade/100.00 (Ujian 1)"].astype(float) * 0.15).round(2)
|
18 |
+
return df
|
19 |
+
|
20 |
+
df = load_data()
|
21 |
+
|
22 |
+
def cari_npm(npm):
|
23 |
+
df_cari = df[df["First name"] == npm]
|
24 |
+
return df_cari
|
25 |
+
|
26 |
+
def susun_data(data_npm):
|
27 |
+
columns_to_display = ["Surname", "First name", "Grade/100.00 (Ujian 1)", "Persentase Ujian 1 (15%)"]
|
28 |
+
st.table(data_npm[columns_to_display])
|
29 |
+
|
30 |
+
colors = ['red', 'green', 'blue']
|
31 |
+
|
32 |
+
st.title("Grafik Batang Nilai Ujian Assesmen 1 Seluruh Mahasiswa")
|
33 |
+
kolom1, kolom2, kolom3 = st.columns(3)
|
34 |
+
|
35 |
+
with kolom1:
|
36 |
+
grades = df["Grade/100.00 (Ujian 1)"]
|
37 |
+
count_below_50 = (grades < 50).sum()
|
38 |
+
count_50_to_68 = ((grades >= 50) & (grades <= 68)).sum()
|
39 |
+
count_above_68 = (grades > 68).sum()
|
40 |
+
|
41 |
+
data = {
|
42 |
+
'Category': ['Below 50', '50 - 68', 'Above 68'],
|
43 |
+
'Count': [count_below_50, count_50_to_68, count_above_68]
|
44 |
+
}
|
45 |
+
df_counts = pd.DataFrame(data)
|
46 |
+
st.write("Ujian 1")
|
47 |
+
plt.clf() # Clear the current figure
|
48 |
+
time.sleep(0.2)
|
49 |
+
plt.bar(df_counts['Category'], df_counts['Count'], color=colors)
|
50 |
+
plt.xlabel('Rentang')
|
51 |
+
plt.ylabel('Jumlah Mahasiswa')
|
52 |
+
st.pyplot(plt)
|
53 |
+
|
54 |
+
with kolom2:
|
55 |
+
st.write("Ujian 2")
|
56 |
+
|
57 |
+
with kolom3:
|
58 |
+
st.write("Ujian Final")
|
59 |
+
|
60 |
+
st.sidebar.info("Masukkan NPM Lengkap!")
|
61 |
+
st.title("Nilai Per Mahasiswa")
|
62 |
+
npm = st.sidebar.text_input("NPM")
|
63 |
+
if st.sidebar.button(label="Cari"):
|
64 |
+
data_npm = cari_npm(npm)
|
65 |
+
susun_data(data_npm)
|
requirements.txt
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==5.0.1
|
2 |
+
attrs==23.1.0
|
3 |
+
blinker==1.6.2
|
4 |
+
cachetools==5.3.1
|
5 |
+
certifi==2023.5.7
|
6 |
+
charset-normalizer==3.1.0
|
7 |
+
click==8.1.3
|
8 |
+
colorama==0.4.6
|
9 |
+
contourpy==1.0.7
|
10 |
+
cycler==0.11.0
|
11 |
+
decorator==5.1.1
|
12 |
+
fonttools==4.39.4
|
13 |
+
gitdb==4.0.10
|
14 |
+
GitPython==3.1.31
|
15 |
+
idna==3.4
|
16 |
+
importlib-metadata==6.6.0
|
17 |
+
Jinja2==3.1.2
|
18 |
+
jsonschema==4.17.3
|
19 |
+
kiwisolver==1.4.4
|
20 |
+
markdown-it-py==2.2.0
|
21 |
+
MarkupSafe==2.1.3
|
22 |
+
matplotlib==3.7.1
|
23 |
+
mdurl==0.1.2
|
24 |
+
numpy==1.24.3
|
25 |
+
packaging==23.1
|
26 |
+
pandas==2.0.2
|
27 |
+
Pillow==9.5.0
|
28 |
+
protobuf==4.23.2
|
29 |
+
pyarrow==12.0.0
|
30 |
+
pydeck==0.8.1b0
|
31 |
+
Pygments==2.15.1
|
32 |
+
Pympler==1.0.1
|
33 |
+
pyparsing==3.0.9
|
34 |
+
pyrsistent==0.19.3
|
35 |
+
python-dateutil==2.8.2
|
36 |
+
pytz==2023.3
|
37 |
+
pytz-deprecation-shim==0.1.0.post0
|
38 |
+
requests==2.31.0
|
39 |
+
rich==13.4.1
|
40 |
+
six==1.16.0
|
41 |
+
smmap==5.0.0
|
42 |
+
streamlit==1.23.1
|
43 |
+
tenacity==8.2.2
|
44 |
+
toml==0.10.2
|
45 |
+
toolz==0.12.0
|
46 |
+
tornado==6.3.2
|
47 |
+
typing_extensions==4.6.3
|
48 |
+
tzdata==2023.3
|
49 |
+
tzlocal==4.3
|
50 |
+
urllib3==2.0.2
|
51 |
+
validators==0.20.0
|
52 |
+
watchdog==3.0.0
|
53 |
+
zipp==3.15.0
|