Skip to content

Commit daac0c8

Browse files
committed
fix: must either be empty or all are sparse
1 parent 5c58daa commit daac0c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/dtypes/concat.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ def _get_series_result_type(result, objs=None):
8989
def _get_frame_result_type(result, objs):
9090
"""
9191
return appropriate class of DataFrame-like concat
92-
if any block is SparseBlock, return SparseDataFrame
92+
if all blocks are SparseBlock, return SparseDataFrame
9393
otherwise, return 1st obj
9494
"""
95-
if all(b.is_sparse for b in result.blocks):
95+
if result.blocks and all(b.is_sparse for b in result.blocks):
9696
from pandas.core.sparse.api import SparseDataFrame
9797
return SparseDataFrame
9898
else:

0 commit comments

Comments
 (0)