Skip to content

Commit

Permalink
Add tests for 16874
Browse files Browse the repository at this point in the history
  • Loading branch information
hexgnu committed Jan 5, 2018
1 parent 41411d4 commit c69a40e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.23.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Reshaping
- Bug in :func:`Series.rank` where ``Series`` containing ``NaT`` modifies the ``Series`` inplace (:issue:`18521`)
- Bug in :func:`cut` which fails when using readonly arrays (:issue:`18773`)
- 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`)
- 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`)
- 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`)


Numeric
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/sparse/test_combine_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ def test_concat_sparse_dense(self, fill_value):
# See GH18914 and #18686 for why this should be
# A DataFrame
assert isinstance(res, pd.DataFrame)
# See GH16874
assert res.isnull()
assert res[res.columns[0]]
assert res.iloc[0,0]
for column in self.dense3.columns:
tm.assert_series_equal(res[column], exp[column])

Expand All @@ -346,6 +350,10 @@ def test_concat_sparse_dense(self, fill_value):
res = pd.concat([sparse, self.dense3], axis=1)
exp = pd.concat([self.dense1, self.dense3], axis=1)
assert isinstance(res, pd.DataFrame)
# See GH16874
assert res.isnull()
assert res[res.columns[0]]
assert res.iloc[0,0]
for column in self.dense3.columns:
tm.assert_series_equal(res[column], exp[column])
tm.assert_frame_equal(res, exp)

0 comments on commit c69a40e

Please sign in to comment.