Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,18 +4,15 @@ import matplotlib.pyplot as plt
|
|
| 4 |
import seaborn as sns
|
| 5 |
import matplotlib.font_manager as fm
|
| 6 |
|
| 7 |
-
|
| 8 |
# ν°νΈ μ€μ
|
| 9 |
font_path = r"NanumGothic.ttf" # ν°νΈ νμΌ κ²½λ‘ μ€μ
|
| 10 |
-
font_prop = fm.FontProperties(fname=font_path
|
| 11 |
-
plt.rcParams['font.family'] =
|
| 12 |
plt.rcParams['axes.unicode_minus'] = False
|
| 13 |
|
| 14 |
# μ¬μ΄λλ°μ λͺ©μ°¨ μΆκ°
|
| 15 |
st.sidebar.title("λͺ©μ°¨")
|
| 16 |
-
page = st.sidebar.radio("νμ΄μ§ μ ν", [
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
if page == "μ°λ Ήλ λ° μ±λ³μ λ°λ₯Έ μμ 5κ° λμΆ λμ":
|
| 21 |
st.title("μ°λ Ήλ λ° μ±λ³μ λ°λ₯Έ μμ 5κ° λμΆ λμ")
|
|
@@ -30,7 +27,9 @@ if page == "μ°λ Ήλ λ° μ±λ³μ λ°λ₯Έ μμ 5κ° λμΆ λμ":
|
|
| 30 |
|
| 31 |
# μμ 5κ° λμ μΆμΆ ν¨μ
|
| 32 |
def get_top_books(data, top_n=5):
|
| 33 |
-
return data.groupby(['μ°λ Ή', 'μ±λ³'])
|
|
|
|
|
|
|
| 34 |
|
| 35 |
# μμ 5κ°μ λμ λ°μ΄ν° μΆμΆ
|
| 36 |
top_books = get_top_books(book_patterns)
|
|
|
|
| 4 |
import seaborn as sns
|
| 5 |
import matplotlib.font_manager as fm
|
| 6 |
|
|
|
|
| 7 |
# ν°νΈ μ€μ
|
| 8 |
font_path = r"NanumGothic.ttf" # ν°νΈ νμΌ κ²½λ‘ μ€μ
|
| 9 |
+
font_prop = fm.FontProperties(fname=font_path)
|
| 10 |
+
plt.rcParams['font.family'] = font_prop.get_name() # λλ μ§μ ν°νΈ μ΄λ¦μ μ¬μ©: 'Nanum Gothic'
|
| 11 |
plt.rcParams['axes.unicode_minus'] = False
|
| 12 |
|
| 13 |
# μ¬μ΄λλ°μ λͺ©μ°¨ μΆκ°
|
| 14 |
st.sidebar.title("λͺ©μ°¨")
|
| 15 |
+
page = st.sidebar.radio("νμ΄μ§ μ ν", ["μ°λ Ήλ λ° μ±λ³μ λ°λ₯Έ μμ 5κ° λμΆ λμ", "μ°λ Ήλ λ° μ±λ³μ λ°λ₯Έ μμ 3κ° μ₯λ₯΄"])
|
|
|
|
|
|
|
| 16 |
|
| 17 |
if page == "μ°λ Ήλ λ° μ±λ³μ λ°λ₯Έ μμ 5κ° λμΆ λμ":
|
| 18 |
st.title("μ°λ Ήλ λ° μ±λ³μ λ°λ₯Έ μμ 5κ° λμΆ λμ")
|
|
|
|
| 27 |
|
| 28 |
# μμ 5κ° λμ μΆμΆ ν¨μ
|
| 29 |
def get_top_books(data, top_n=5):
|
| 30 |
+
return data.groupby(['μ°λ Ή', 'μ±λ³']) \
|
| 31 |
+
.apply(lambda x: x.nlargest(top_n, 'λμΆκ±΄μ')) \
|
| 32 |
+
.reset_index(drop=True)
|
| 33 |
|
| 34 |
# μμ 5κ°μ λμ λ°μ΄ν° μΆμΆ
|
| 35 |
top_books = get_top_books(book_patterns)
|