@@ -794,6 +794,19 @@ 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
+ assert_frame_equal(df2, df2)
809
+
797
810
def test_delitem_corner(self):
798
811
f = self.frame.copy()
799
812
del f['D']
@@ -2821,7 +2834,7 @@ def custom_frame_function(self):
2821
2834
data = {'col1': range(10),
2822
2835
'col2': range(10)}
2823
2836
cdf = CustomDataFrame(data)
2824
-
2837
+
2825
2838
# Did we get back our own DF class?
2826
2839
self.assertTrue(isinstance(cdf, CustomDataFrame))
2827
2840
@@ -2833,7 +2846,7 @@ def custom_frame_function(self):
2833
2846
# Do we get back our own DF class after slicing row-wise?
2834
2847
cdf_rows = cdf[1:5]
2835
2848
self.assertTrue(isinstance(cdf_rows, CustomDataFrame))
2836
- self.assertEqual(cdf_rows.custom_frame_function(), 'OK')
2849
+ self.assertEqual(cdf_rows.custom_frame_function(), 'OK')
2837
2850
2838
2851
# Make sure sliced part of multi-index frame is custom class
2839
2852
mcol = pd.MultiIndex.from_tuples([('A', 'A'), ('A', 'B')])
0 commit comments