Skip to content

BUG: AttributeError: 'bool' object has no attribute 'to_numpy' in "mask_missing" method of core/missing.py #47101

Open
@rainnnnny

Description

@rainnnnny

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas
import numpy
from qpython.qcollection import qlist

res = pandas.Series(data=qlist([True, True, False, False], qtype=1, adjust_dtype=False)).replace(False, numpy.NaN)

Issue Description

image

image

new_mask = arr == x

this expected to get an array-like object with bool elements, like [False, False, True, ...] , but when arr being an special array-like object, like the qlist object in example , the expression returns a single False, which is a bool object, thus we'll get the exception shown above

Expected Behavior

returns an array-like object instead of a bool object

Installed Versions

1.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugConstructorsSeries/DataFrame/Index/pd.array ConstructorsRegressionFunctionality that used to work in a prior pandas versionSubclassingSubclassing pandas objectsreplacereplace method

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions