Skip to content

concat([sparse]) should be a Series / DataFrame #25702

Closed
@TomAugspurger

Description

@TomAugspurger

I messed up the logic somewhere along the way.

In [11]: df = pd.DataFrame({"A": pd.SparseArray([0, 1])})

In [12]: type(pd.concat([df, df]))
Out[12]: pandas.core.sparse.frame.SparseDataFrame

That should be a DataFrame with sparse values.

When should concat return a SparseSeries/Frame?

a.) When any of the inputs are SparseSeries / SparseDataFrame
b.) When all of the inputs are SparseSeries/Frame.

Option b is probably least disruptive. Implementing it isn't a pain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SparseSparse Data Type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions