Skip to content

BUG: AssertionError using mask on a dataframe with shape (1, n) #4071

Closed
@lnlrbr

Description

@lnlrbr

Using a DataFrame of bools to mask some values in another dataframe works great:

In [84]: pd.DataFrame([[1,2],[3,4]]).mask(pd.DataFrame([[True,False],[False, True]]))
Out[84]: 
    0   1
0 NaN   2
1   3 NaN

but not if we try on a dataframe with a single index:

In [85]: pd.DataFrame([[1,2],]).mask(pd.DataFrame([[True,False],]))
AssertionError: Number of Block dimensions (1) must equal number of axes (2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

        翻译: