Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -49,6 +49,34 @@ def load_data(file):
|
|
49 |
else:
|
50 |
st.error("μ§μλμ§ μλ νμΌ νμμ
λλ€. CSV, XLS, λλ XLSX νμΌμ μ
λ‘λν΄μ£ΌμΈμ.")
|
51 |
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
return data
|
53 |
|
54 |
def manual_data_entry():
|
|
|
49 |
else:
|
50 |
st.error("μ§μλμ§ μλ νμΌ νμμ
λλ€. CSV, XLS, λλ XLSX νμΌμ μ
λ‘λν΄μ£ΌμΈμ.")
|
51 |
return None
|
52 |
+
|
53 |
+
# λΉ μ΄μ΄ μλ κ²½μ° λΌλ²¨λ§ μ²λ¦¬
|
54 |
+
if data.columns.isnull().any():
|
55 |
+
new_columns = []
|
56 |
+
for i, col in enumerate(data.columns):
|
57 |
+
if pd.isnull(col):
|
58 |
+
new_columns.append(f'Column_{i+1}')
|
59 |
+
else:
|
60 |
+
new_columns.append(col)
|
61 |
+
data.columns = new_columns
|
62 |
+
|
63 |
+
st.warning("μΌλΆ μ΄ μ΄λ¦μ΄ λΉμ΄ μμ΄μ μλμΌλ‘ μ΄λ¦μ λΆμ¬νμ΅λλ€.")
|
64 |
+
|
65 |
+
# μ¬μ©μμκ² μ΄ μ΄λ¦ μμ κΈ°ν μ 곡
|
66 |
+
st.write("νμ¬ μ΄ μ΄λ¦:")
|
67 |
+
st.write(data.columns.tolist())
|
68 |
+
|
69 |
+
if st.checkbox("μ΄ μ΄λ¦μ μμ νμκ² μ΅λκΉ?"):
|
70 |
+
new_column_names = st.text_input("μλ‘μ΄ μ΄ μ΄λ¦μ μΌνλ‘ κ΅¬λΆνμ¬ μ
λ ₯νμΈμ:",
|
71 |
+
value=",".join(data.columns))
|
72 |
+
new_column_names = [name.strip() for name in new_column_names.split(",")]
|
73 |
+
|
74 |
+
if len(new_column_names) == len(data.columns):
|
75 |
+
data.columns = new_column_names
|
76 |
+
st.success("μ΄ μ΄λ¦μ΄ μ±κ³΅μ μΌλ‘ μ
λ°μ΄νΈλμμ΅λλ€.")
|
77 |
+
else:
|
78 |
+
st.error("μ
λ ₯ν μ΄ μ΄λ¦μ κ°μκ° νμ¬ μ΄ κ°μμ μΌμΉνμ§ μμ΅λλ€.")
|
79 |
+
|
80 |
return data
|
81 |
|
82 |
def manual_data_entry():
|