JUNGU commited on
Commit
9d2af22
ยท
verified ยท
1 Parent(s): 9618cb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -363,23 +363,30 @@ def perform_analysis():
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
385
  column1 = st.selectbox("์ฒซ ๋ฒˆ์งธ ์—ด ์„ ํƒ:", numeric_columns)
 
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
+ active_slicers = list(st.session_state.slicers.keys())
368
+
369
+ group_column = st.selectbox(
370
+ "๊ทธ๋ฃน ๊ตฌ๋ถ„์„ ์œ„ํ•œ ์—ด ์„ ํƒ:",
371
+ options=active_slicers + [col for col in st.session_state.categorical_columns if col not in active_slicers]
372
+ )
373
 
374
  value_column = st.selectbox("๋น„๊ตํ•  ๊ฐ’์ด ์žˆ๋Š” ์—ด ์„ ํƒ:", st.session_state.numeric_columns)
375
 
376
+
377
  if st.button("๋…๋ฆฝ ํ‘œ๋ณธ T-๊ฒ€์ • ์ˆ˜ํ–‰"):
378
+ # ์„ ํƒ๋œ ๊ทธ๋ฃน์˜ ์œ ๋‹ˆํฌ ๊ฐ’ ํ™•์ธ
379
+ if group_column in st.session_state.slicers:
380
+ unique_groups = st.session_state.slicers[group_column]
381
+ else:
382
+ unique_groups = st.session_state.filtered_data[group_column].unique()
383
+
384
  if len(unique_groups) == 2:
385
  perform_independent_ttest(st.session_state.filtered_data, group_column, value_column)
386
  else:
387
  st.error(f"์„ ํƒ๋œ ๊ทธ๋ฃน ๋ณ€์ˆ˜ '{group_column}'์—๋Š” ์ •ํ™•ํžˆ ๋‘ ๊ฐœ์˜ ๊ทธ๋ฃน์ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ ๊ทธ๋ฃน ์ˆ˜: {len(unique_groups)}")
388
+
389
+
390
  elif test_type == "๋Œ€์‘ ํ‘œ๋ณธ":
391
  numeric_columns = st.session_state.numeric_columns
392
  column1 = st.selectbox("์ฒซ ๋ฒˆ์งธ ์—ด ์„ ํƒ:", numeric_columns)