File tree 3 files changed +23
-2
lines changed
3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -677,7 +677,7 @@ Bug Fixes
677
677
- Bug in ``pd.read_msgpack()`` in which ``Series`` categoricals were being improperly processed (:issue:`14901`)
678
678
- Bug in ``Series.ffill()`` with mixed dtypes containing tz-aware datetimes. (:issue:`14956`)
679
679
680
-
680
+ - Bug in ``DataFrame.isin`` comparing datetimelike to empty frame (:issue:`15473`)
681
681
682
682
- Bug in ``Series.where()`` and ``DataFrame.where()`` where array-like conditionals were being rejected (:issue:`15414`)
683
683
- Bug in ``Series`` construction with a datetimetz (:issue:`14928`)
Original file line number Diff line number Diff line change @@ -1249,7 +1249,7 @@ def na_op(x, y):
1249
1249
result = op (x , y )
1250
1250
except TypeError :
1251
1251
xrav = x .ravel ()
1252
- result = np .empty (x .size , dtype = x . dtype )
1252
+ result = np .empty (x .size , dtype = bool )
1253
1253
if isinstance (y , (np .ndarray , ABCSeries )):
1254
1254
yrav = y .ravel ()
1255
1255
mask = notnull (xrav ) & notnull (yrav )
Original file line number Diff line number Diff line change @@ -1502,6 +1502,27 @@ def test_isin_multiIndex(self):
1502
1502
result = df1 .isin (df2 )
1503
1503
tm .assert_frame_equal (result , expected )
1504
1504
1505
+ def test_isin_empty_datetimelike (self ):
1506
+ # GH 15473
1507
+ df1_ts = DataFrame ({'date' :
1508
+ pd .to_datetime (['2014-01-01' , '2014-01-02' ])})
1509
+ df1_td = DataFrame ({'date' :
1510
+ [pd .Timedelta (1 , 's' ), pd .Timedelta (2 , 's' )]})
1511
+ df2 = DataFrame ({'date' : []})
1512
+ df3 = DataFrame ()
1513
+
1514
+ expected = DataFrame ({'date' : [False , False ]})
1515
+
1516
+ result = df1_ts .isin (df2 )
1517
+ tm .assert_frame_equal (result , expected )
1518
+ result = df1_ts .isin (df3 )
1519
+ tm .assert_frame_equal (result , expected )
1520
+
1521
+ result = df1_td .isin (df2 )
1522
+ tm .assert_frame_equal (result , expected )
1523
+ result = df1_td .isin (df3 )
1524
+ tm .assert_frame_equal (result , expected )
1525
+
1505
1526
# ----------------------------------------------------------------------
1506
1527
# Row deduplication
1507
1528
You can’t perform that action at this time.
0 commit comments