Skip to content

Commit c69a40e

Browse files
committed
Add tests for 16874
1 parent 41411d4 commit c69a40e

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
@@ -363,7 +363,7 @@ Reshaping
363363
- Bug in :func:`Series.rank` where ``Series`` containing ``NaT`` modifies the ``Series`` inplace (:issue:`18521`)
364364
- Bug in :func:`cut` which fails when using readonly arrays (:issue:`18773`)
365365
- 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`)
366-
- 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`)
366+
- 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`)
367367

368368

369369
Numeric

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)