[Python] Before include_groups=True disappears it same works?

Discussão em 'Python' iniciado por Stack, Abril 7, 2025.

  1. Stack

    Stack Membro Participativo

    Before include_groups=True disappears it same works?

    groub_keys = True,include_groups = False

    stratification = housing.groupby('income_cat',observed = True,group_keys = True)
    stratified_sampling = stratification.apply(lambda y:y.sample(frac=0.1, random_state=1234), include_groups=False)


    vs

    group_keys = False,include_groups=True

    stratification = housing.groupby('income_cat',observed = True,group_keys = False)
    stratified_sampling = stratification.apply(lambda y:y.sample(frac=0.1, random_state=1234), include_groups=True)


    When group_keys = False, include_groups = True, it was included as a general column, not as a multi-index. Before include_groups=True disappears. Did it print the same result?

    Continue reading...

Compartilhe esta Página