added var split_group

This commit is contained in:
2026-02-02 23:15:05 +01:00
parent 3ac330263f
commit 611fc8d19a
2 changed files with 81 additions and 43 deletions

View File

@@ -1,6 +1,6 @@
import marimo
__generated_with = "0.19.2"
__generated_with = "0.19.7"
app = marimo.App(width="full")
@@ -285,7 +285,6 @@ def _(S, mo, v_18_8_3):
def _(S, calculate_weighted_ranking_scores, data):
top3_voices = S.get_top_3_voices(data)[0]
top3_voices_weighted = calculate_weighted_ranking_scores(top3_voices)
return top3_voices, top3_voices_weighted

View File

@@ -71,7 +71,6 @@ def _(S, data_all):
mo.md(f"""
# Data Validation
{check_progress(data_all)}
@@ -104,25 +103,23 @@ def _(data_all):
return (data_validated,)
@app.cell(hide_code=True)
@app.cell
def _():
return
@app.cell
@app.cell(hide_code=True)
def _():
#
return
@app.cell(hide_code=True)
@app.cell
def _():
mo.md(r"""
---
# Introduction (Respondent Demographics)
## Lucia confirmation missing 'Consumer' data
""")
return
@@ -135,14 +132,6 @@ def _(S, data_validated):
@app.cell(hide_code=True)
def _():
mo.md(r"""
## Lucia confirmation missing 'Consumer' data
""")
return
@app.cell
def _(demographics):
# Demographics where 'Consumer' is null
demographics_no_consumer = demographics.filter(pl.col('Consumer').is_null())['_recordId'].to_list()
@@ -189,7 +178,7 @@ def _():
@app.cell
def _():
mo.md(r"""
## Demographic Distributions
# Demographic Distributions
""")
return
@@ -209,7 +198,6 @@ def _():
@app.cell
def _(S, data, demo_plot_cols):
_content = """
## Demographic Distributions
"""
for c in demo_plot_cols:
@@ -229,7 +217,7 @@ def _():
mo.md(r"""
---
# Brand Character Results
# Brand Character Results (overall)
""")
return
@@ -400,7 +388,7 @@ def _(S, char_df):
return character_colors, consistent_sort_order
@app.cell(hide_code=True)
@app.cell
def _():
mo.md(r"""
## Statistical significance best characters
@@ -412,15 +400,24 @@ def _():
return
@app.cell
@app.cell(hide_code=True)
def _():
mo.md(r"""
# BC per Consumer
""")
return
@app.cell
def _():
mo.md(r"""
## Character Ranking Points (per customer segment)
split_group = 'Consumer'
return (split_group,)
@app.cell
def _(split_group):
mo.md(rf"""
## Character Ranking Points (per {split_group} segment)
""")
return
@@ -449,9 +446,9 @@ def _(S, data):
@app.cell
def _():
mo.md(r"""
## Character Ranking Place 1-2-3 in one (per consumer)
def _(split_group):
mo.md(rf"""
## Character Ranking Place 1-2-3 in one (per {split_group})
""")
return
@@ -476,9 +473,9 @@ def _(S, data):
@app.cell
def _():
mo.md(r"""
## Character Ranking times 1st place (per consumer)
def _(split_group):
mo.md(rf"""
## Character Ranking times 1st place (per {split_group})
""")
return
@@ -502,9 +499,9 @@ def _(S, data):
@app.cell
def _():
mo.md(r"""
## Predefined personality traits WordClouds per Consumer
def _(split_group):
mo.md(rf"""
## Predefined personality traits WordClouds per {split_group}
""")
return
@@ -531,9 +528,9 @@ def _(S, data):
@app.cell
def _():
mo.md(r"""
## Frequency traits chosen - per consumer segment
def _(split_group):
mo.md(rf"""
## Frequency traits chosen - per {split_group} segment
""")
return
@@ -565,7 +562,7 @@ def _(S, character_colors, consistent_sort_order, data):
return
@app.cell(hide_code=True)
@app.cell
def _():
mo.md(r"""
---
@@ -582,7 +579,7 @@ def _(S, data):
return top3_voices, top3_voices_weighted
@app.cell
@app.cell(hide_code=True)
def _():
mo.md(r"""
## Which voice is ranked best in the ranking question for top 3?
@@ -679,7 +676,7 @@ def _():
return
@app.cell(hide_code=True)
@app.cell
def _():
mo.md(r"""
## Voice Scale 1-10
@@ -694,7 +691,7 @@ def _(S, data):
return (voice_1_10,)
@app.cell
@app.cell(hide_code=True)
def _(S, voice_1_10):
S.plot_average_scores_with_counts(voice_1_10, x_label='Voice', width=1000, domain=[1,10], title="Voice General Impression (Scale 1-10)")
return
@@ -742,5 +739,47 @@ def _(S, voice_1_10):
return
@app.cell
def _():
mo.md(r"""
### Statistical Significance (Scale 1-10)
""")
return
@app.cell
def _(S, voice_1_10):
# Compute pairwise significance tests
pairwise_df, metadata = S.compute_pairwise_significance(
voice_1_10,
test_type="mannwhitney", # or "ttest", "chi2", "auto"
alpha=0.05,
correction="bonferroni" # or "holm", "none"
)
# View significant pairs
# print(pairwise_df.filter(pl.col('significant') == True))
# Create heatmap visualization
_heatmap = S.plot_significance_heatmap(
pairwise_df,
metadata=metadata,
title="Voice Rating Significance<br>(Pairwise Comparisons)"
)
# Create summary bar chart
_summary = S.plot_significance_summary(
pairwise_df,
metadata=metadata
)
mo.md(f"""
{mo.ui.altair_chart(_heatmap)}
{mo.ui.altair_chart(_summary)}
""")
return
if __name__ == "__main__":
app.run()