Skip to content

Commit 05a0717

Browse files
committed
Add tests for 16874
1 parent ba8dc29 commit 05a0717

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/source/whatsnew/v0.23.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ Reshaping
448448
- Bug in :func:`cut` which fails when using readonly arrays (:issue:`18773`)
449449
- Bug in :func:`Dataframe.pivot_table` which fails when the ``aggfunc`` arg is of type string. The behavior is now consistent with other methods like ``agg`` and ``apply`` (:issue:`18713`)
450450
- Bug in :func:`DataFrame.merge` in which merging using ``Index`` objects as vectors raised an Exception (:issue:`19038`)
451-
- Bug in :func:`concat` when concatting sparse and dense series it returns only a SparseDataFrame. Should be a DataFrame. (:issue:`18914`, :issue:`18686`, and :issue:`16874`)
451+
- Bug in :func:`concat` when concatting sparse and dense series it returns only a ``SparseDataFrame``. Should be a ``DataFrame``. (:issue:`18914`, :issue:`18686`, and :issue:`16874`)
452452

453453
Numeric
454454
^^^^^^^

pandas/tests/sparse/test_combine_concat.py

+8
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ def test_concat_sparse_dense(self, fill_value):
338338
# See GH18914 and #18686 for why this should be
339339
# A DataFrame
340340
assert isinstance(res, pd.DataFrame)
341+
# See GH16874
342+
assert res.isnull()
343+
assert res[res.columns[0]]
344+
assert res.iloc[0,0]
341345
for column in self.dense3.columns:
342346
tm.assert_series_equal(res[column], exp[column])
343347

@@ -346,6 +350,10 @@ def test_concat_sparse_dense(self, fill_value):
346350
res = pd.concat([sparse, self.dense3], axis=1)
347351
exp = pd.concat([self.dense1, self.dense3], axis=1)
348352
assert isinstance(res, pd.DataFrame)
353+
# See GH16874
354+
assert res.isnull()
355+
assert res[res.columns[0]]
356+
assert res.iloc[0,0]
349357
for column in self.dense3.columns:
350358
tm.assert_series_equal(res[column], exp[column])
351359
tm.assert_frame_equal(res, exp)

0 commit comments

Comments
 (0)