@@ -286,27 +286,26 @@ def test_concat_different_columns_sort_warns(self):
286
286
287
287
def test_concat_different_columns (self ):
288
288
# fill_value = np.nan
289
- # sparse = self.dense1.to_sparse()
290
- # sparse3 = self.dense3.to_sparse()
291
-
292
- # res = pd.concat([sparse, sparse3], sort=True)
293
- # exp = pd.concat([self.dense1, self.dense3], sort=True).to_sparse()
294
- # tm.assert_sp_frame_equal(res, exp, check_kind=False)
295
- #
296
- # res = pd.concat([sparse3, sparse], sort=True)
297
- # exp = pd.concat([self.dense3, self.dense1], sort=True).to_sparse()
298
- # exp._default_fill_value = np.nan
299
- # tm.assert_sp_frame_equal(res, exp, check_kind=False)
300
- #
301
- # # fill_value = 0
289
+ sparse = self .dense1 .to_sparse ()
290
+ sparse3 = self .dense3 .to_sparse ()
291
+
292
+ res = pd .concat ([sparse , sparse3 ], sort = True )
293
+ exp = pd .concat ([self .dense1 , self .dense3 ], sort = True ).to_sparse ()
294
+ tm .assert_sp_frame_equal (res , exp , check_kind = False )
295
+
296
+ res = pd .concat ([sparse3 , sparse ], sort = True )
297
+ exp = pd .concat ([self .dense3 , self .dense1 ], sort = True ).to_sparse ()
298
+ exp ._default_fill_value = np .nan
299
+ tm .assert_sp_frame_equal (res , exp , check_kind = False )
300
+
301
+ @pytest .mark .xfail (reason = "concat sparse and dense" , strict = True )
302
+ def test_concat_different_columns_buggy (self ):
303
+ # I'm confused here. We're getting different fill values
304
+ # and so different sparse values for C (all NaN and not present).
305
+ # fill_value = 0
302
306
sparse = self .dense1 .to_sparse (fill_value = 0 )
303
307
sparse3 = self .dense3 .to_sparse (fill_value = 0 )
304
308
305
- # this test is buggy. from here on out
306
- # exp doesn't handle C (all NaN) correctly.
307
- # We correctly don't have any sparse values since the
308
- # values are all NaN, and the fill_value is 0.
309
- # raise pytest.xfail("Test is buggy.")
310
309
res = pd .concat ([sparse , sparse3 ], sort = True )
311
310
exp = (pd .concat ([self .dense1 , self .dense3 ], sort = True )
312
311
.to_sparse (fill_value = 0 ))
0 commit comments