straight line fn dev

This commit is contained in:
2026-01-29 13:20:32 +01:00
parent 70719702ec
commit bc12df28a5
4 changed files with 160 additions and 44 deletions

View File

@@ -11,15 +11,13 @@ def _():
from pathlib import Path
from utils import JPMCSurvey, combine_exclusive_columns
from plots import plot_average_scores_with_counts, plot_top3_ranking_distribution
return (
JPMCSurvey,
combine_exclusive_columns,
mo,
pl,
plot_average_scores_with_counts,
plot_top3_ranking_distribution,
)
return JPMCSurvey, combine_exclusive_columns, mo, pl
@app.cell
def _(mo):
mo.outline()
return
@app.cell
@@ -66,11 +64,10 @@ def _(data, mo, pl):
def check_progress(data):
if data.collect().select(pl.col('progress').unique()).shape[0] == 1:
return mo.md("""## ✅ All responses are complete (progress = 100) """)
return mo.md("## ⚠️ There are incomplete responses (progress < 100) ⚠️")
check_progress(data)
return
@@ -87,11 +84,11 @@ def _(data, mo, pl):
std_duration = duration_stats['std_duration'][0]
upper_outlier_threshold = mean_duration + 3 * std_duration
lower_outlier_threshold = mean_duration - 3 * std_duration
_d = data.with_columns(
((pl.col('duration') > upper_outlier_threshold) | (pl.col('duration') < lower_outlier_threshold)).alias('outlier_duration')
)
# Show durations with outlier flag is true
outlier_data = _d.filter(pl.col('outlier_duration') == True).collect()
@@ -105,16 +102,16 @@ def _(data, mo, pl):
- Upper Outlier Threshold (Mean + 3*Std): {upper_outlier_threshold:.2f} seconds
- Lower Outlier Threshold (Mean - 3*Std): {lower_outlier_threshold:.2f} seconds
- Number of Outlier Responses: {outlier_data.shape[0]}
Outliers:
{mo.ui.table(outlier_data)}
**⚠️ NOTE: These have not been removed from the dataset ⚠️**
""")
duration_validation(data)
return
@@ -229,10 +226,18 @@ def _(mo):
@app.cell
def _(data, survey):
_lf, _choice_map = survey.get_ss_green_blue(data)
# _lf.collect()
print(_lf.collect().head())
return
@app.cell
def _(df):
df
return
@app.cell
def _(mo):
mo.md(r"""
@@ -297,7 +302,6 @@ def _(data, survey):
traits_refined = survey.get_character_refine(data)[0]
traits_refined.collect()
return (traits_refined,)