JUNGU commited on
Commit
d089e25
ยท
verified ยท
1 Parent(s): 24ef9c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -5,12 +5,10 @@ import plotly.express as px
5
  import plotly.graph_objects as go
6
  from io import StringIO
7
  import openpyxl
8
- from st_aggrid import AgGrid, GridUpdateMode
9
- from st_aggrid.grid_options_builder import GridOptionsBuilder
10
  import matplotlib.font_manager as fm
11
 
12
  # ํ•œ๊ธ€ ํฐํŠธ ์„ค์ •
13
- font_path = "./Pretendard-Bold.ttf" # ์‹ค์ œ ํฐํŠธ ํŒŒ์ผ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ์„ธ์š”
14
  fm.fontManager.addfont(font_path)
15
  plt.rc('font', family='Pretendard-Bold') # 'your_font_name'์„ ์‹ค์ œ ํฐํŠธ ์ด๋ฆ„์œผ๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ์„ธ์š”
16
 
@@ -31,18 +29,12 @@ def manual_data_entry():
31
  col_names = [name.strip() for name in col_names if name.strip()]
32
 
33
  if col_names:
34
- num_rows = st.number_input("ํ–‰์˜ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”:", min_value=1, value=5)
35
  data = pd.DataFrame(columns=col_names, index=range(num_rows))
36
 
37
- gd = GridOptionsBuilder.from_dataframe(data)
38
- gd.configure_default_column(editable=True)
39
- gridoptions = gd.build()
40
 
41
- grid_table = AgGrid(data, gridOptions=gridoptions,
42
- update_mode=GridUpdateMode.VALUE_CHANGED,
43
- height=400)
44
-
45
- return grid_table['data']
46
  return None
47
 
48
  def preprocess_data(data):
@@ -140,10 +132,11 @@ def main():
140
 
141
  if data is not None:
142
  st.write("๋ฐ์ดํ„ฐ ๋ฏธ๋ฆฌ๋ณด๊ธฐ:")
143
- st.write(data.head())
144
 
145
- data = preprocess_data(data)
146
- perform_analysis(data)
 
147
 
148
  if __name__ == "__main__":
149
  main()
 
5
  import plotly.graph_objects as go
6
  from io import StringIO
7
  import openpyxl
 
 
8
  import matplotlib.font_manager as fm
9
 
10
  # ํ•œ๊ธ€ ํฐํŠธ ์„ค์ •
11
+ font_path = "Pretendard-Bold.ttf" # ์‹ค์ œ ํฐํŠธ ํŒŒ์ผ ๊ฒฝ๋กœ๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ์„ธ์š”
12
  fm.fontManager.addfont(font_path)
13
  plt.rc('font', family='Pretendard-Bold') # 'your_font_name'์„ ์‹ค์ œ ํฐํŠธ ์ด๋ฆ„์œผ๋กœ ๋ณ€๊ฒฝํ•ด์ฃผ์„ธ์š”
14
 
 
29
  col_names = [name.strip() for name in col_names if name.strip()]
30
 
31
  if col_names:
32
+ num_rows = st.number_input("์ดˆ๊ธฐ ํ–‰์˜ ์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”:", min_value=1, value=5)
33
  data = pd.DataFrame(columns=col_names, index=range(num_rows))
34
 
35
+ edited_data = st.experimental_data_editor(data, num_rows="dynamic")
 
 
36
 
37
+ return edited_data
 
 
 
 
38
  return None
39
 
40
  def preprocess_data(data):
 
132
 
133
  if data is not None:
134
  st.write("๋ฐ์ดํ„ฐ ๋ฏธ๋ฆฌ๋ณด๊ธฐ:")
135
+ st.write(data)
136
 
137
+ if st.button("๋ฐ์ดํ„ฐ ๋ถ„์„ ์‹œ์ž‘"):
138
+ data = preprocess_data(data)
139
+ perform_analysis(data)
140
 
141
  if __name__ == "__main__":
142
  main()