Concat does not work for sparse series · Issue #10536 · pandas-dev/pandas (original) (raw)

Concatenating two sparse series does not return sparse data structures as expected:

In [1]: import pandas as pd

In [2]: ts = pd.Series([0, 1, 1, 2, 3, 0 ,0 ,0])

In [3]: sts = ts.to_sparse()

In [4]: print type(pd.concat([sts, sts], axis=0))
<class 'pandas.core.series.Series'>

In [5]: print type(pd.concat([sts, sts], axis=1))
<class 'pandas.core.frame.DataFrame'>

The above does work correctly for SparseDataFrames.