Skip to content

Commit 3cf64cb

Browse files
committed
TST: Adding test to concat Sparse arrays
1 parent ba742da commit 3cf64cb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/reshape/test_concat.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,3 +2730,13 @@ def test_concat_datetimeindex_freq():
27302730
expected = pd.DataFrame(data[50:] + data[:50], index=dr[50:].append(dr[:50]))
27312731
expected.index._data.freq = None
27322732
tm.assert_frame_equal(result, expected)
2733+
2734+
2735+
def test_concat_sparse():
2736+
# GH 23557
2737+
a = pd.Series(pd.SparseArray([0, 1, 2]))
2738+
expected = pd.DataFrame(data=[[0, 0], [1, 1], [2, 2]]).astype(
2739+
pd.SparseDtype("int", 0)
2740+
)
2741+
result = pd.concat([a, a], axis=1)
2742+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)