BUG: AssertionError using mask on a dataframe with shape (1, n) · Issue #4071 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@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)