AMKhakbaz commited on
Commit
f03004a
·
verified ·
1 Parent(s): beba094

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +265 -273
app.py CHANGED
@@ -504,304 +504,296 @@ st.markdown('[Click to register a suggestion or comment](https://docs.google.com
504
 
505
 
506
  # Main options
507
- main_option = st.selectbox("Please select an option:", ["Tabulation", "Funnel", "Hypothesis test", "Machine Learning", "Coding"])
508
 
509
- if main_option == "Tabulation":
510
- st.header("Tabulation Analysis")
511
- uploaded_file = st.file_uploader("Please upload your Excel file", type=["xlsx", "xls"])
512
  if uploaded_file:
513
  try:
514
  df = pd.read_excel(uploaded_file)
515
  st.subheader("Displaying the first few rows of the DataFrame")
516
  st.dataframe(df.head())
517
 
518
- tabulation_option = st.selectbox("Please select the type of analysis:", ["Univariate", "Multivariate", "All"])
519
-
520
- if tabulation_option == "All":
521
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
  cols = edit_strings(df.columns)
523
  cols = sorted(list(set(cols)))
524
 
525
- st.sidebar.header("Settings")
526
-
527
- main_dict = {"single": [], "multi": [], "score": []}
528
-
529
- st.sidebar.subheader("Main")
530
- main_dict["single"] = st.sidebar.multiselect(
531
- 'Main: Single answer questions',
532
  cols,
533
  default=[]
534
  )
535
 
536
- main_dict["multi"] = st.sidebar.multiselect(
537
- 'Main: Multi answer questions',
538
- cols,
539
- default=[]
540
- )
541
-
542
- main_dict["score"] = st.sidebar.multiselect(
543
- 'Main: Score answer questions',
544
  cols,
545
  default=[]
546
  )
547
-
548
- st.sidebar.subheader("Follow")
549
-
550
- follow_dict = {"single": [], "multi": [], "score": []}
551
 
552
- st.sidebar.subheader("Main")
553
- follow_dict["single"] = st.sidebar.multiselect(
554
- 'Follow: Single answer questions',
555
- cols,
556
- default=[]
557
- )
558
 
559
- follow_dict["multi"] = st.sidebar.multiselect(
560
- 'Follow: Multi answer questions',
561
- cols,
562
- default=[]
563
- )
564
-
565
- follow_dict["score"] = st.sidebar.multiselect(
566
- 'Follow: Score answer questions',
567
- cols,
568
- default=[]
569
- )
570
-
571
- all_tabulation(df, main_dict, follow_dict)
572
 
573
- elif tabulation_option == "Univariate":
574
- uni_option = st.selectbox("Select the type of univariate analysis:", ["Multiple answer", "Single answer", "Score answer"])
575
-
576
- if uni_option == "Single answer":
577
- var = st.text_input("Please enter the name of the desired column:")
578
- if var:
579
- if var in df.columns:
580
- result_df = single_answer(df[var])
581
- st.subheader("Univariate Analysis Results")
582
- st.dataframe(result_df)
583
-
584
- fig = figo('Bar', result_df["Percentage"][:-1, ], title='Percentage Histogram', xlabel=var, ylabel='Percentage', colorscale='Plotly3')
585
- st.plotly_chart(fig, use_container_width=True)
586
- else:
587
- st.error("The entered column was not found.")
588
- elif uni_option == "Multiple answer":
589
- var = st.text_input("Please enter the name of the desired column:")
590
- if var:
591
- matching_cols = [col for col in df.columns if is_matching_pattern(col, var)]
592
- if matching_cols:
593
- subset_df = df[matching_cols]
594
- result_df = multi_answer(subset_df)
595
-
596
- st.subheader("Multiple Answer Analysis Results")
597
- st.dataframe(result_df)
598
-
599
- fig = figo('Bar', result_df["Percentage"][:-1], title='Percentage Histogram', xlabel=var, ylabel='Percentage', colorscale='Plotly3')
600
- st.plotly_chart(fig, use_container_width=True)
601
- else:
602
- st.error("No columns matching the entered pattern were found.")
603
-
604
- elif uni_option == "Score answer":
605
- var = st.text_input("Please enter the name of the desired column:")
606
- if var:
607
- subset_df = df[var]
608
- result_df = score_answer(subset_df)
609
-
610
- st.subheader("Score Answer Analysis Results")
611
- st.dataframe(result_df)
612
-
613
- fig = figo('Bar', result_df["Percentage"][:-2], title='Percentage Histogram', xlabel=var, ylabel='Percentage', colorscale='Plotly3')
614
- st.plotly_chart(fig, use_container_width=True)
615
- else:
616
- st.error("No columns matching the entered pattern were found.")
617
-
618
- elif tabulation_option == "Multivariate":
619
- st.subheader("Multivariate Analysis")
620
- var1 = st.text_input("Please enter the name of the first column:")
621
- var2 = st.text_input("Please enter the name of the second column:")
622
-
623
- if var1 and var2:
624
- type1 = st.selectbox("Select the type of analysis for the first column:", ["Multiple answer", "Single answer"], key='type1')
625
- type2 = st.selectbox("Select the type of analysis for the second column:", ["Multiple answer", "Single answer", "Score answer"], key='type2')
626
-
627
- if type1 == "Single answer" and type2 == "Single answer":
628
- percentile_df, frequency_df = two_variable_ss(df[[var1, var2]], var1, var2)
629
- st.subheader("Percentage Table")
630
- st.write(z_test_data(percentile_df))
631
-
632
- st.subheader("Frequency Table")
633
- st.dataframe(frequency_df)
634
-
635
- row, col = df.shape
636
- fig = figo('Scatter', percentile_df.iloc[:-1,:], title='Percentage Scatter plot', width=(col*5)+5, height=(row*25) + 10)
637
- st.plotly_chart(fig, use_container_width=True)
638
-
639
- elif type1 == "Single answer" and type2 == "Multiple answer":
640
- matching_cols = [col for col in df.columns if is_matching_pattern(col, var2)]
641
- if matching_cols:
642
- percentile_df, frequency_df = two_variable_sm(df[[var1] + matching_cols], var1, matching_cols)
643
- st.subheader("Percentage Table")
644
- st.write(z_test_data(percentile_df))
645
-
646
- st.subheader("Frequency Table")
647
- st.dataframe(frequency_df)
648
-
649
- row, col = df.shape
650
- fig = figo('Scatter', percentile_df.iloc[:-1,:], title='Percentage Scatter plot', width=(col*5)+5, height=(row*25) + 10)
651
- st.plotly_chart(fig, use_container_width=True)
652
-
653
- else:
654
- st.error("No columns matching the entered pattern were found.")
655
-
656
- elif type1 == "Multiple answer" and type2 == "Multiple answer":
657
- matching_cols1 = [col for col in df.columns if is_matching_pattern(col, var1)]
658
- matching_cols2 = [col for col in df.columns if is_matching_pattern(col, var2)]
659
- if matching_cols1 and matching_cols2:
660
- percentile_df, frequency_df = two_variable_mm(df[matching_cols1 + matching_cols2], matching_cols1, matching_cols2)
661
- st.subheader("Percentage Table")
662
- st.write(z_test_data(percentile_df))
663
-
664
- st.subheader("Frequency Table")
665
- st.dataframe(frequency_df)
666
-
667
- row, col = df.shape
668
- fig = figo('Scatter', percentile_df.iloc[:-1,:], title='Percentage Scatter plot', width=(col*5)+5, height=(row*25) + 10)
669
- st.plotly_chart(fig, use_container_width=True)
670
-
671
- elif type1 == "Single answer" and type2 == "Score answer":
672
-
673
- mean_df = two_variable_ssc(df[[var1, var2]], var1, var2)
674
- st.subheader("Mean Table")
675
- st.write(t_test_data(mean_df))
676
-
677
- row, col = df.shape
678
- fig = figo('Bar', mean_df["Mean"][:-1], title='Mean Histogram', xlabel=var1, ylabel='Mean', colorscale='Plotly3')
679
- st.plotly_chart(fig, use_container_width=True)
680
-
681
-
682
- elif type1 == "Multiple answer" and type2 == "Score answer":
683
- matching_cols1 = [col for col in df.columns if is_matching_pattern(col, var1)]
684
- if matching_cols1:
685
- mean_df = two_variable_msc(df[matching_cols1 + [var2]], matching_cols1, var2)
686
- st.subheader("Mean Table")
687
- st.write(t_test_data(mean_df))
688
-
689
- row, col = df.shape
690
- fig = figo('Bar', mean_df["Mean"][:-1], title='Mean Histogram', xlabel=var1, ylabel='Mean', colorscale='Plotly3')
691
- st.plotly_chart(fig, use_container_width=True)
692
- else:
693
- st.info("This section of the program is under development.")
694
-
695
- except Exception as e:
696
- st.error(f"❌ Error reading the Excel file: {e}")
697
-
698
- elif main_option == "Funnel":
699
- st.header("Funnel")
700
 
701
- uploaded_file = st.file_uploader("Please upload your Excel file", type=["xlsx", "xls"])
702
- if uploaded_file:
703
- try:
704
- df = pd.read_excel(uploaded_file)
705
- st.subheader("Displaying the first few rows of the DataFrame")
706
- st.dataframe(df.head())
707
-
708
- cols = edit_strings(df.columns)
709
- cols = sorted(list(set(cols)))
710
-
711
- st.sidebar.header("Funnel Settings")
712
- single_list = st.sidebar.multiselect(
713
- 'Single answer questions',
714
- cols,
715
- default=[]
716
- )
717
-
718
- multi_list = st.sidebar.multiselect(
719
- 'Multi answer questions',
720
- cols,
721
- default=[]
722
- )
723
- selected_dict = {}
724
-
725
- for option in single_list:
726
- selected_dict[option] = "Single"
727
- for option in multi_list:
728
- selected_dict[option] = "Multi"
729
-
730
- funnel_frequency, funnel_percentage = funnel(df, selected_dict)
731
- st.subheader("Percentage Table")
732
- st.dataframe(funnel_percentage)
733
-
734
- st.subheader("Frequency Table")
735
- st.dataframe(funnel_frequency)
736
-
737
- st.sidebar.header("Chart Settings")
738
- bar_columns = st.sidebar.multiselect('Which columns should be displayed as bar charts?', sorted(funnel_percentage.columns))
739
- line_columns = st.sidebar.multiselect('Which columns should be displayed as line charts?', sorted(funnel_percentage.columns))
740
-
741
- funnel_percentage_cleaned = funnel_percentage.dropna(axis=0, how='all')
742
-
743
- fig = go.Figure()
744
-
745
- # Define modern and diverse color palette
746
- modern_colors = [
747
- "#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1",
748
- "#955251", "#B565A7", "#009B77", "#DD4124", "#45B8AC"
749
- ]
750
-
751
- # Add Bar traces with transparency and custom colors
752
- for idx, col in enumerate(bar_columns):
753
- funnel_percentage_col = funnel_percentage_cleaned[col]
754
- fig.add_trace(
755
- go.Bar(
756
- x=funnel_percentage_cleaned.index,
757
- y=funnel_percentage_col,
758
- name=col,
759
- marker_color=modern_colors[idx % len(modern_colors)], # Cycle through colors
760
- opacity=0.8 # Set transparency
761
  )
762
- )
763
-
764
- # Add Line traces with transparency and custom colors
765
- for idx, col in enumerate(line_columns):
766
- funnel_percentage_col = funnel_percentage_cleaned[col]
767
- fig.add_trace(
768
- go.Scatter(
769
- x=funnel_percentage_cleaned.index,
770
- y=funnel_percentage_col,
771
- mode='lines',
772
- name=col,
773
- line=dict(color=modern_colors[(idx + len(bar_columns)) % len(modern_colors)]), # Cycle through colors
774
- opacity=0.8 # Set transparency
775
  )
 
 
 
 
 
 
 
 
776
  )
 
 
 
 
 
 
 
777
 
778
- fig.update_layout(
779
- title="Combined Bar and Line Chart",
780
- xaxis_title="Brands",
781
- yaxis_title="Percentage",
782
- template="plotly_dark",
783
- barmode="group",
784
- xaxis=dict(tickmode='linear')
785
- )
786
 
787
- st.plotly_chart(fig)
 
788
 
789
  except Exception as e:
790
- st.error(f"❌ Error reading the Excel file: {e}")
791
-
792
-
793
- elif main_option == "Hypothesis test":
794
- st.header("Hypothesis Testing")
795
- hypothesis_option = st.selectbox("Please select the type of hypothesis test:", ["Z test", "T test", "Chi-Square test", "ANOVA test"])
796
-
797
- if hypothesis_option != "Z test":
798
- st.info("This section of the program is under development.")
799
- else:
800
- uploaded_file = st.file_uploader("Please upload your Excel file for Z-Test", type=["xlsx", "xls"])
801
- if uploaded_file:
802
- result = analyze_z_test(uploaded_file)
803
- if result:
804
- st.success("Z-Test analysis completed successfully.")
805
-
806
- elif main_option in ["Machine Learning", "Coding"]:
807
- st.info("This section of the program is under development.")
 
504
 
505
 
506
  # Main options
 
507
 
508
+ uploaded_file = st.file_uploader("Please upload your Excel file", type=["xlsx", "xls"])
 
 
509
  if uploaded_file:
510
  try:
511
  df = pd.read_excel(uploaded_file)
512
  st.subheader("Displaying the first few rows of the DataFrame")
513
  st.dataframe(df.head())
514
 
515
+ main_option = st.selectbox("Please select an option:", ["Tabulation", "Funnel", "Hypothesis test", "Machine Learning", "Coding"])
516
+
517
+ if main_option == "Tabulation":
518
+ st.header("Tabulation Analysis")
519
+
520
+ tabulation_option = st.selectbox("Please select the type of analysis:", ["Univariate", "Multivariate", "All"])
521
+
522
+ if tabulation_option == "All":
523
+
524
+ cols = edit_strings(df.columns)
525
+ cols = sorted(list(set(cols)))
526
+
527
+ st.sidebar.header("Settings")
528
+
529
+ main_dict = {"single": [], "multi": [], "score": []}
530
+
531
+ st.sidebar.subheader("Main")
532
+ main_dict["single"] = st.sidebar.multiselect(
533
+ 'Main: Single answer questions',
534
+ cols,
535
+ default=[]
536
+ )
537
+
538
+ main_dict["multi"] = st.sidebar.multiselect(
539
+ 'Main: Multi answer questions',
540
+ cols,
541
+ default=[]
542
+ )
543
+
544
+ main_dict["score"] = st.sidebar.multiselect(
545
+ 'Main: Score answer questions',
546
+ cols,
547
+ default=[]
548
+ )
549
+
550
+ st.sidebar.subheader("Follow")
551
+
552
+ follow_dict = {"single": [], "multi": [], "score": []}
553
+
554
+ st.sidebar.subheader("Main")
555
+ follow_dict["single"] = st.sidebar.multiselect(
556
+ 'Follow: Single answer questions',
557
+ cols,
558
+ default=[]
559
+ )
560
+
561
+ follow_dict["multi"] = st.sidebar.multiselect(
562
+ 'Follow: Multi answer questions',
563
+ cols,
564
+ default=[]
565
+ )
566
+
567
+ follow_dict["score"] = st.sidebar.multiselect(
568
+ 'Follow: Score answer questions',
569
+ cols,
570
+ default=[]
571
+ )
572
+
573
+ all_tabulation(df, main_dict, follow_dict)
574
+
575
+ elif tabulation_option == "Univariate":
576
+ uni_option = st.selectbox("Select the type of univariate analysis:", ["Multiple answer", "Single answer", "Score answer"])
577
+
578
+ if uni_option == "Single answer":
579
+ var = st.text_input("Please enter the name of the desired column:")
580
+ if var:
581
+ if var in df.columns:
582
+ result_df = single_answer(df[var])
583
+ st.subheader("Univariate Analysis Results")
584
+ st.dataframe(result_df)
585
+
586
+ fig = figo('Bar', result_df["Percentage"][:-1, ], title='Percentage Histogram', xlabel=var, ylabel='Percentage', colorscale='Plotly3')
587
+ st.plotly_chart(fig, use_container_width=True)
588
+ else:
589
+ st.error("The entered column was not found.")
590
+ elif uni_option == "Multiple answer":
591
+ var = st.text_input("Please enter the name of the desired column:")
592
+ if var:
593
+ matching_cols = [col for col in df.columns if is_matching_pattern(col, var)]
594
+ if matching_cols:
595
+ subset_df = df[matching_cols]
596
+ result_df = multi_answer(subset_df)
597
+
598
+ st.subheader("Multiple Answer Analysis Results")
599
+ st.dataframe(result_df)
600
+
601
+ fig = figo('Bar', result_df["Percentage"][:-1], title='Percentage Histogram', xlabel=var, ylabel='Percentage', colorscale='Plotly3')
602
+ st.plotly_chart(fig, use_container_width=True)
603
+ else:
604
+ st.error("No columns matching the entered pattern were found.")
605
+
606
+ elif uni_option == "Score answer":
607
+ var = st.text_input("Please enter the name of the desired column:")
608
+ if var:
609
+ subset_df = df[var]
610
+ result_df = score_answer(subset_df)
611
+
612
+ st.subheader("Score Answer Analysis Results")
613
+ st.dataframe(result_df)
614
+
615
+ fig = figo('Bar', result_df["Percentage"][:-2], title='Percentage Histogram', xlabel=var, ylabel='Percentage', colorscale='Plotly3')
616
+ st.plotly_chart(fig, use_container_width=True)
617
+ else:
618
+ st.error("No columns matching the entered pattern were found.")
619
+
620
+ elif tabulation_option == "Multivariate":
621
+ st.subheader("Multivariate Analysis")
622
+ var1 = st.text_input("Please enter the name of the first column:")
623
+ var2 = st.text_input("Please enter the name of the second column:")
624
+
625
+ if var1 and var2:
626
+ type1 = st.selectbox("Select the type of analysis for the first column:", ["Multiple answer", "Single answer"], key='type1')
627
+ type2 = st.selectbox("Select the type of analysis for the second column:", ["Multiple answer", "Single answer", "Score answer"], key='type2')
628
+
629
+ if type1 == "Single answer" and type2 == "Single answer":
630
+ percentile_df, frequency_df = two_variable_ss(df[[var1, var2]], var1, var2)
631
+ st.subheader("Percentage Table")
632
+ st.write(z_test_data(percentile_df))
633
+
634
+ st.subheader("Frequency Table")
635
+ st.dataframe(frequency_df)
636
+
637
+ row, col = df.shape
638
+ fig = figo('Scatter', percentile_df.iloc[:-1,:], title='Percentage Scatter plot', width=(col*5)+5, height=(row*25) + 10)
639
+ st.plotly_chart(fig, use_container_width=True)
640
+
641
+ elif type1 == "Single answer" and type2 == "Multiple answer":
642
+ matching_cols = [col for col in df.columns if is_matching_pattern(col, var2)]
643
+ if matching_cols:
644
+ percentile_df, frequency_df = two_variable_sm(df[[var1] + matching_cols], var1, matching_cols)
645
+ st.subheader("Percentage Table")
646
+ st.write(z_test_data(percentile_df))
647
+
648
+ st.subheader("Frequency Table")
649
+ st.dataframe(frequency_df)
650
+
651
+ row, col = df.shape
652
+ fig = figo('Scatter', percentile_df.iloc[:-1,:], title='Percentage Scatter plot', width=(col*5)+5, height=(row*25) + 10)
653
+ st.plotly_chart(fig, use_container_width=True)
654
+
655
+ else:
656
+ st.error("No columns matching the entered pattern were found.")
657
+
658
+ elif type1 == "Multiple answer" and type2 == "Multiple answer":
659
+ matching_cols1 = [col for col in df.columns if is_matching_pattern(col, var1)]
660
+ matching_cols2 = [col for col in df.columns if is_matching_pattern(col, var2)]
661
+ if matching_cols1 and matching_cols2:
662
+ percentile_df, frequency_df = two_variable_mm(df[matching_cols1 + matching_cols2], matching_cols1, matching_cols2)
663
+ st.subheader("Percentage Table")
664
+ st.write(z_test_data(percentile_df))
665
+
666
+ st.subheader("Frequency Table")
667
+ st.dataframe(frequency_df)
668
+
669
+ row, col = df.shape
670
+ fig = figo('Scatter', percentile_df.iloc[:-1,:], title='Percentage Scatter plot', width=(col*5)+5, height=(row*25) + 10)
671
+ st.plotly_chart(fig, use_container_width=True)
672
+
673
+ elif type1 == "Single answer" and type2 == "Score answer":
674
+
675
+ mean_df = two_variable_ssc(df[[var1, var2]], var1, var2)
676
+ st.subheader("Mean Table")
677
+ st.write(t_test_data(mean_df))
678
+
679
+ row, col = df.shape
680
+ fig = figo('Bar', mean_df["Mean"][:-1], title='Mean Histogram', xlabel=var1, ylabel='Mean', colorscale='Plotly3')
681
+ st.plotly_chart(fig, use_container_width=True)
682
+
683
+
684
+ elif type1 == "Multiple answer" and type2 == "Score answer":
685
+ matching_cols1 = [col for col in df.columns if is_matching_pattern(col, var1)]
686
+ if matching_cols1:
687
+ mean_df = two_variable_msc(df[matching_cols1 + [var2]], matching_cols1, var2)
688
+ st.subheader("Mean Table")
689
+ st.write(t_test_data(mean_df))
690
+
691
+ row, col = df.shape
692
+ fig = figo('Bar', mean_df["Mean"][:-1], title='Mean Histogram', xlabel=var1, ylabel='Mean', colorscale='Plotly3')
693
+ st.plotly_chart(fig, use_container_width=True)
694
+ else:
695
+ st.info("This section of the program is under development.")
696
+
697
+ elif main_option == "Funnel":
698
+ st.header("Funnel")
699
+
700
  cols = edit_strings(df.columns)
701
  cols = sorted(list(set(cols)))
702
 
703
+ st.sidebar.header("Funnel Settings")
704
+ single_list = st.sidebar.multiselect(
705
+ 'Single answer questions',
 
 
 
 
706
  cols,
707
  default=[]
708
  )
709
 
710
+ multi_list = st.sidebar.multiselect(
711
+ 'Multi answer questions',
 
 
 
 
 
 
712
  cols,
713
  default=[]
714
  )
715
+ selected_dict = {}
 
 
 
716
 
717
+ for option in single_list:
718
+ selected_dict[option] = "Single"
719
+ for option in multi_list:
720
+ selected_dict[option] = "Multi"
 
 
721
 
722
+ funnel_frequency, funnel_percentage = funnel(df, selected_dict)
723
+ st.subheader("Percentage Table")
724
+ st.dataframe(funnel_percentage)
 
 
 
 
 
 
 
 
 
 
725
 
726
+ st.subheader("Frequency Table")
727
+ st.dataframe(funnel_frequency)
728
+
729
+ st.sidebar.header("Chart Settings")
730
+ bar_columns = st.sidebar.multiselect('Which columns should be displayed as bar charts?', sorted(funnel_percentage.columns))
731
+ line_columns = st.sidebar.multiselect('Which columns should be displayed as line charts?', sorted(funnel_percentage.columns))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
 
733
+ funnel_percentage_cleaned = funnel_percentage.dropna(axis=0, how='all')
734
+
735
+ fig = go.Figure()
736
+
737
+ # Define modern and diverse color palette
738
+ modern_colors = [
739
+ "#FF6F61", "#6B5B95", "#88B04B", "#F7CAC9", "#92A8D1",
740
+ "#955251", "#B565A7", "#009B77", "#DD4124", "#45B8AC"
741
+ ]
742
+
743
+ # Add Bar traces with transparency and custom colors
744
+ for idx, col in enumerate(bar_columns):
745
+ funnel_percentage_col = funnel_percentage_cleaned[col]
746
+ fig.add_trace(
747
+ go.Bar(
748
+ x=funnel_percentage_cleaned.index,
749
+ y=funnel_percentage_col,
750
+ name=col,
751
+ marker_color=modern_colors[idx % len(modern_colors)], # Cycle through colors
752
+ opacity=0.8 # Set transparency
753
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
754
  )
755
+
756
+ # Add Line traces with transparency and custom colors
757
+ for idx, col in enumerate(line_columns):
758
+ funnel_percentage_col = funnel_percentage_cleaned[col]
759
+ fig.add_trace(
760
+ go.Scatter(
761
+ x=funnel_percentage_cleaned.index,
762
+ y=funnel_percentage_col,
763
+ mode='lines',
764
+ name=col,
765
+ line=dict(color=modern_colors[(idx + len(bar_columns)) % len(modern_colors)]), # Cycle through colors
766
+ opacity=0.8 # Set transparency
767
+ )
768
  )
769
+
770
+ fig.update_layout(
771
+ title="Combined Bar and Line Chart",
772
+ xaxis_title="Brands",
773
+ yaxis_title="Percentage",
774
+ template="plotly_dark",
775
+ barmode="group",
776
+ xaxis=dict(tickmode='linear')
777
  )
778
+
779
+ st.plotly_chart(fig)
780
+
781
+
782
+ elif main_option == "Hypothesis test":
783
+ st.header("Hypothesis Testing")
784
+ hypothesis_option = st.selectbox("Please select the type of hypothesis test:", ["Z test", "T test", "Chi-Square test", "ANOVA test"])
785
 
786
+ if hypothesis_option != "Z test":
787
+ st.info("This section of the program is under development.")
788
+ else:
789
+ uploaded_file = st.file_uploader("Please upload your Excel file for Z-Test", type=["xlsx", "xls"])
790
+ if uploaded_file:
791
+ result = analyze_z_test(uploaded_file)
792
+ if result:
793
+ st.success("Z-Test analysis completed successfully.")
794
 
795
+ elif main_option in ["Machine Learning", "Coding"]:
796
+ st.info("This section of the program is under development.")
797
 
798
  except Exception as e:
799
+ st.error(f"❌ Error reading the Excel file: {e}")