JUNGU commited on
Commit
9618cb5
ยท
verified ยท
1 Parent(s): 24de67a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -362,10 +362,23 @@ def perform_analysis():
362
  test_type = st.radio("T-๊ฒ€์ • ์œ ํ˜• ์„ ํƒ:", ["๋…๋ฆฝ ํ‘œ๋ณธ", "๋Œ€์‘ ํ‘œ๋ณธ", "๋‹จ์ผ ํ‘œ๋ณธ"])
363
 
364
  if test_type == "๋…๋ฆฝ ํ‘œ๋ณธ":
365
- group_column = st.selectbox("๊ทธ๋ฃน ๊ตฌ๋ถ„์„ ์œ„ํ•œ ์—ด ์„ ํƒ:", st.session_state.categorical_columns)
 
 
 
 
 
 
 
366
  value_column = st.selectbox("๋น„๊ตํ•  ๊ฐ’์ด ์žˆ๋Š” ์—ด ์„ ํƒ:", st.session_state.numeric_columns)
 
367
  if st.button("๋…๋ฆฝ ํ‘œ๋ณธ T-๊ฒ€์ • ์ˆ˜ํ–‰"):
368
- perform_independent_ttest(st.session_state.filtered_data, group_column, value_column)
 
 
 
 
 
369
 
370
  elif test_type == "๋Œ€์‘ ํ‘œ๋ณธ":
371
  numeric_columns = st.session_state.numeric_columns
 
362
  test_type = st.radio("T-๊ฒ€์ • ์œ ํ˜• ์„ ํƒ:", ["๋…๋ฆฝ ํ‘œ๋ณธ", "๋Œ€์‘ ํ‘œ๋ณธ", "๋‹จ์ผ ํ‘œ๋ณธ"])
363
 
364
  if test_type == "๋…๋ฆฝ ํ‘œ๋ณธ":
365
+ # ์Šฌ๋ผ์ด์„œ์—์„œ ์„ ํƒ๋œ ๋ฒ”์ฃผํ˜• ๋ณ€์ˆ˜ ๋ชฉ๋ก ์ƒ์„ฑ
366
+ active_slicers = [col for col in st.session_state.slicers.keys() if st.session_state.slicers[col]]
367
+
368
+ if active_slicers:
369
+ group_column = st.selectbox("๊ทธ๋ฃน ๊ตฌ๋ถ„์„ ์œ„ํ•œ ์—ด ์„ ํƒ:", active_slicers + st.session_state.categorical_columns)
370
+ else:
371
+ group_column = st.selectbox("๊ทธ๋ฃน ๊ตฌ๋ถ„์„ ์œ„ํ•œ ์—ด ์„ ํƒ:", st.session_state.categorical_columns)
372
+
373
  value_column = st.selectbox("๋น„๊ตํ•  ๊ฐ’์ด ์žˆ๋Š” ์—ด ์„ ํƒ:", st.session_state.numeric_columns)
374
+
375
  if st.button("๋…๋ฆฝ ํ‘œ๋ณธ T-๊ฒ€์ • ์ˆ˜ํ–‰"):
376
+ # ์„ ํƒ๋œ ๊ทธ๋ฃน ๋ณ€์ˆ˜์˜ ์œ ๋‹ˆํฌ ๊ฐ’์ด 2๊ฐœ์ธ์ง€ ํ™•์ธ
377
+ unique_groups = st.session_state.filtered_data[group_column].unique()
378
+ if len(unique_groups) == 2:
379
+ perform_independent_ttest(st.session_state.filtered_data, group_column, value_column)
380
+ else:
381
+ st.error(f"์„ ํƒ๋œ ๊ทธ๋ฃน ๋ณ€์ˆ˜ '{group_column}'์—๋Š” ์ •ํ™•ํžˆ ๋‘ ๊ฐœ์˜ ๊ทธ๋ฃน์ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ ๊ทธ๋ฃน ์ˆ˜: {len(unique_groups)}")
382
 
383
  elif test_type == "๋Œ€์‘ ํ‘œ๋ณธ":
384
  numeric_columns = st.session_state.numeric_columns