@@ -794,6 +794,18 @@ def test_setitem_empty(self):
794
794
result.loc[result.b.isnull(), 'a'] = result.a
795
795
assert_frame_equal(result, df)
796
796
797
+ def test_setitem_empty_frame_with_boolean(self):
798
+ # Test for issue #10126
799
+
800
+ for dtype in ('float', 'int64'):
801
+ for df in [
802
+ pd.DataFrame(dtype=dtype),
803
+ pd.DataFrame(dtype=dtype, index=[1]),
804
+ pd.DataFrame(dtype=dtype, columns=['A']),
805
+ ]:
806
+ df2 = df.copy()
807
+ df[df > df2] = 47
808
+
797
809
def test_delitem_corner(self):
798
810
f = self.frame.copy()
799
811
del f['D']
@@ -2821,7 +2833,7 @@ def custom_frame_function(self):
2821
2833
data = {'col1': range(10),
2822
2834
'col2': range(10)}
2823
2835
cdf = CustomDataFrame(data)
2824
-
2836
+
2825
2837
# Did we get back our own DF class?
2826
2838
self.assertTrue(isinstance(cdf, CustomDataFrame))
2827
2839
@@ -2833,7 +2845,7 @@ def custom_frame_function(self):
2833
2845
# Do we get back our own DF class after slicing row-wise?
2834
2846
cdf_rows = cdf[1:5]
2835
2847
self.assertTrue(isinstance(cdf_rows, CustomDataFrame))
2836
- self.assertEqual(cdf_rows.custom_frame_function(), 'OK')
2848
+ self.assertEqual(cdf_rows.custom_frame_function(), 'OK')
2837
2849
2838
2850
# Make sure sliced part of multi-index frame is custom class
2839
2851
mcol = pd.MultiIndex.from_tuples([('A', 'A'), ('A', 'B')])
0 commit comments