def canonize_dtypes_and_names(a=None, t=None, y=None, w=None, X=None):
    """
    Housekeeping method that assign names for unnamed series and canonizes their data types.

    Args:
        a (pd.Series|None): Treatment assignment of size (num_subjects,).
        t (pd.Series|None): Followup duration, size (num_subjects,).
        y (pd.Series|None): Observed outcome (1) or right censoring event (0), size (num_subjects,).
        w (pd.Series|None): Optional subject weights
        X (pd.DataFrame|None): Baseline covariate matrix of size (num_subjects, num_features).

    Returns:
        a, y, t, w, X
    """
    if a is not None:
        a = a.astype(int)
        a.name = 'a' if a.name is None else a.name

    if t is not None:
        t = t.astype(int)
        t.name = 't' if t.name is None else t.name

    if y is not None:
        y = y.astype(int)
        y.name = 'y' if y.name is None else y.name

    if w is not None:
        w.name = 'w' if w.name is None else w.name

    # Set index name
    for obj in [a, y, t, w, X]:
        if obj is not None and obj.index.name is None:
            obj.index.name = 'id'

    return a, t, y, w, X