import pandas as pd


def compute_overall_stats(df: pd.DataFrame) -> dict:
    s = df["speed"]
    return {
        "min_speed": s.min(),
        "max_speed": s.max(),
        "mean_speed": s.mean(),
        "std_speed": s.std(ddof=1),
        "count": len(df),
    }


def compute_group_stats(groups: list) -> list:
    result = []
    for i, g in enumerate(groups):
        s = g["speed"]
        std = s.std(ddof=1) if len(g) > 1 else None
        result.append({
            "group_index": i + 1,
            "count": len(g),
            "min_speed": s.min(),
            "max_speed": s.max(),
            "mean_speed": s.mean(),
            "std_speed": std,
            "time_start": g["time"].min().strftime("%H:%M:%S"),
            "time_end": g["time"].max().strftime("%H:%M:%S"),
        })
    return result
