Skip to content

BooleanArray does not support bitwise operations in the stubs #1411

@cmp0xff

Description

@cmp0xff

Describe the bug

BooleanArray does not support bitwise operations in the stubs, which works at runtime.

To Reproduce

Script

from typing import cast, reveal_type
import pandas as pd

from pandas.core.arrays.boolean import BooleanArray


a = pd.array([True], dtype="boolean")
reveal_type(a)  # IntegerArray, runtime: BooleanArray

a = cast(BooleanArray, a)
_ = a & a  # pyright gives reportOperatorIssue

Typechecker

pyright

Error messages

  ttest.py:8:13 - information: Type of "a" is "IntegerArray"
  ttest.py:11:5 - error: Operator "&" not supported for types "BooleanArray" and "BooleanArray" (reportOperatorIssue)

Information

  • version of type checker: 1.1.406
  • version of installed pandas-stubs: main

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConstructorsSeries/DataFrame/Index/pd.array ConstructorsExtensionArrayExtending pandas with custom dtypes or arrays.Numeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions