1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] how to fix `"Series[Any]" not callable [operator]` mypy error

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    For the code below

    import pandas as pd

    df_data = pd.DataFrame(
    [
    {"a": 2, "b": 1},
    {"a": 2, "b": 10},
    {"a": 3, "b": 77},
    ]
    )


    df_data.groupby("a").size().to_frame("size")


    mypy complains

    toy.py:12: error: "Series[Any]" not callable [operator]
    Found 1 error in 1 file (checked 1 source file)


    I know the complain is due to to_frame call, not sure why or how to fix?

    versions:

    • pandas: 2.2.2
    • pandas-stub: 2.2.2.240807
    • mypy: 1.11.2

    Continue reading...

Compartilhe esta Página