Skip to content

Commit

Permalink
fix: must either be empty or all are sparse
Browse files Browse the repository at this point in the history
  • Loading branch information
hexgnu committed Jan 1, 2018
1 parent 5c58daa commit daac0c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/core/dtypes/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def _get_series_result_type(result, objs=None):
def _get_frame_result_type(result, objs):
"""
return appropriate class of DataFrame-like concat
if any block is SparseBlock, return SparseDataFrame
if all blocks are SparseBlock, return SparseDataFrame
otherwise, return 1st obj
"""
if all(b.is_sparse for b in result.blocks):
if result.blocks and all(b.is_sparse for b in result.blocks):
from pandas.core.sparse.api import SparseDataFrame
return SparseDataFrame
else:
Expand Down

0 comments on commit daac0c8

Please sign in to comment.