Skip to content

Wrong type hint for Series.all() and Series.any() #1180

Closed
@Igorsmit00

Description

@Igorsmit00

The Series.all() and Series.any() have the type bool for the output. However, the real output type is np.bool. This causes issues when trying to compile a function using mypyc.

To Reproduce
Compile the following code

def test_function(df: pd.Dataframe):
# some code
is_all_nan = df["column_name"].isna().all()
# some more code

Typechecker mypy/mypyc
TypeError: bool object expected; got numpy.bool_

  • OS: Windows
  • OS Version: 11
  • python version 3.11.6=7
  • mypy version 1.8.0
  • pandas-stubs version 2.2.3.250308

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions