Skip to content

Commit

Permalink
BUG: test that no error is raised on df.where() with empty df & cond
Browse files Browse the repository at this point in the history
  • Loading branch information
pajachiet committed Aug 5, 2018
1 parent 87a270a commit 319f1e2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pandas/tests/frame/test_indexing.py
Expand Up @@ -2939,6 +2939,15 @@ def test_where_callable(self):
tm.assert_frame_equal(result,
(df + 2).where((df + 2) > 8, (df + 2) + 10))

def test_where_empty_df_and_empty_cond_having_non_bool_dtypes(self):
# GH 21947
data = []
df = pd.DataFrame(columns=['a'], data=data)
cond = df.applymap(lambda x: x > 0)
# Should not raise ValueError:
# Boolean array expected for the condition, not object
df.where(cond)

def test_where_tz_values(self, tz_naive_fixture):
df1 = DataFrame(DatetimeIndex(['20150101', '20150102', '20150103'],
tz=tz_naive_fixture),
Expand Down

0 comments on commit 319f1e2

Please sign in to comment.