Character personality ranking complete

This commit is contained in:
2026-01-23 10:50:26 +01:00
parent 5327b50ab0
commit 424355f4a1
5 changed files with 421 additions and 7 deletions

View File

@@ -11,15 +11,20 @@ def _():
from pathlib import Path
from validation import check_progress, duration_validation
from utils import JPMCSurvey, combine_exclusive_columns
from plots import plot_average_scores_with_counts, plot_top3_ranking_distribution
from utils import JPMCSurvey, combine_exclusive_columns, calculate_weighted_ranking_scores
from plots import plot_average_scores_with_counts, plot_top3_ranking_distribution, plot_character_ranking_distribution, plot_most_ranked_1_character, plot_weighted_ranking_score
return (
JPMCSurvey,
Path,
calculate_weighted_ranking_scores,
check_progress,
duration_validation,
mo,
plot_average_scores_with_counts,
plot_character_ranking_distribution,
plot_most_ranked_1_character,
plot_top3_ranking_distribution,
plot_weighted_ranking_score,
)
@@ -108,12 +113,49 @@ def _(mo):
mo.md(r"""
## Character personality ranking
1. Which character personality is ranked best?
2. Which character personality is ranked number 1 the most?
### 1. Which character personality is ranked best?
""")
return
@app.cell
def _(data, survey):
char_rank = survey.get_character_ranking(data)[0].collect()
return (char_rank,)
@app.cell
def _(char_rank, plot_character_ranking_distribution):
plot_character_ranking_distribution(char_rank, x_label='Character Personality', width=1000)
return
@app.cell
def _(mo):
mo.md(r"""
### 2. Which character personality is ranked number 1 the most?
""")
return
@app.cell
def _(
calculate_weighted_ranking_scores,
char_rank,
plot_weighted_ranking_score,
):
char_rank_weighted = calculate_weighted_ranking_scores(char_rank)
plot_weighted_ranking_score(char_rank_weighted, x_label='Voice', width=1000)
return
@app.cell
def _(char_rank, plot_most_ranked_1_character):
plot_most_ranked_1_character(char_rank, x_label='Character Personality', width=1000)
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
@@ -122,6 +164,13 @@ def _(mo):
return
@app.cell
def _(data, survey):
v_18_8_3 = survey.get_18_8_3(data)[0].collect()
print(v_18_8_3.head())
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
@@ -147,6 +196,12 @@ def _(mo):
return
@app.cell
def _(plot_top3_ranking_distribution, top3_voices):
plot_top3_ranking_distribution(top3_voices, x_label='Voice', width=1000)
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""