get_win_stay_lose_switch_df#
- get_win_stay_lose_switch_df(df: DataFrame, by: str | list[str] = 'session', min_trials: int = 10) DataFrame[source]#
Win-stay and lose-switch probabilities of each group of trials.
- Parameters:
df – prepared trials, of one or several subjects (see preprocessing.prepare). Habituation trials are left out.
by – the column(s) that split the trials: “session” (a point per session), “subject” (a point per mouse), “year_month_day” (per day), “trial_group” (through training, see add_trial_group_column)… “subject” is always added, so that the groups of two mice stay apart.
min_trials – groups with fewer wins (or losses) than this get NaN in win_stay (or lose_switch).
- Returns:
win_stay (probability of choosing the same side after a correct trial), lose_switch (probability of choosing the other side after an error), n_wins, n_losses, n_trials, and the columns of by.
- Return type:
A row per group with