[Python] Modin: Unable to access .cat.codes after groupby even though dtype is still category

Discussão em 'Python' iniciado por Stack, Maio 25, 2025.

  1. Stack

    Stack Membro Participativo

    I'm encountering an issue in Modin (v0.32.0) where I can access .cat.codes on a categorical column before a groupby, but not after grouping.

    import modin.pandas as pd

    df = pd.read_parquet(path="../../sample.parquet")
    print(df['DummyCol'].cat.codes)

    data_segments = {}
    for key, group in df.groupby("DATASEGMENT", sort=False):
    data_segments[key] = group

    # This line throws an error
    print(data_segments["202201"]["DummyCol"].cat.codes)



    Sample code to reproduce the issue Dataset is https://github.com/user-attachments/files/20429918/sample.parquet.zip

    If you need any additional info I have raised the issue in modin github: https://github.com/modin-project/modin/issues/7586

    Continue reading...

Compartilhe esta Página