From 7b34c07c591352be71f7df01cdd29972ebda4b18 Mon Sep 17 00:00:00 2001 From: Matthew Kirk Date: Thu, 28 Dec 2017 08:47:15 -0800 Subject: [PATCH] FIX: Cleanup messed up files for PR --- doc/source/whatsnew/v0.23.0.txt | 2 +- pandas/core/internals.py | 5 ----- pandas/core/sparse/frame.py | 2 +- pandas/tests/reshape/test_reshape.py | 2 +- pandas/tests/sparse/test_array.py | 2 +- pandas/tests/sparse/test_frame.py | 3 +++ 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/doc/source/whatsnew/v0.23.0.txt b/doc/source/whatsnew/v0.23.0.txt index a5d9657f76e708..da5340bd50120f 100644 --- a/doc/source/whatsnew/v0.23.0.txt +++ b/doc/source/whatsnew/v0.23.0.txt @@ -353,7 +353,7 @@ Reshaping - Bug in :func:`Series.rank` where ``Series`` containing ``NaT`` modifies the ``Series`` inplace (:issue:`18521`) - Bug in :func:`cut` which fails when using readonly arrays (:issue:`18773`) - Bug in :func:`Dataframe.pivot_table` which fails when the ``aggfunc`` arg is of type string. The behavior is now consistent with other methods like ``agg`` and ``apply`` (:issue:`18713`) -- Bug in :func:`get_dummies` which doesn't cast all columns as sparse which causes reindex to fail. (:issue:`18914`) +- Bug in :func:`pandas.core.dtypes.concat._get_series_result_type` which returns SparseDataFrame even if not all contained in Frame are sparse. (:issue:`18914`) Numeric diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 9064202cdb699f..3a64a0ef84e3dd 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -2756,11 +2756,6 @@ class SparseBlock(NonConsolidatableMixIn, Block): _holder = SparseArray _concatenator = staticmethod(_concat._concat_sparse) - def __init__(self, values, placement, ndim=None, fastpath=False, **kwargs): - super(SparseBlock, self).__init__(self._holder(values), - placement, ndim=ndim, - fastpath=fastpath, **kwargs) - @property def shape(self): return (len(self.mgr_locs), self.sp_index.length) diff --git a/pandas/core/sparse/frame.py b/pandas/core/sparse/frame.py index 6d83267d9b1dea..05f39a8caa6f6d 100644 --- a/pandas/core/sparse/frame.py +++ b/pandas/core/sparse/frame.py @@ -14,7 +14,7 @@ from pandas.core.dtypes.cast import maybe_upcast, find_common_type from pandas.core.dtypes.common import _ensure_platform_int, is_scipy_sparse -from pandas.core.common import _try_sort, is_sparse +from pandas.core.common import _try_sort from pandas.compat.numpy import function as nv from pandas.core.index import Index, MultiIndex, _ensure_index from pandas.core.series import Series diff --git a/pandas/tests/reshape/test_reshape.py b/pandas/tests/reshape/test_reshape.py index 29e700bb782627..e2323a724a3d2d 100644 --- a/pandas/tests/reshape/test_reshape.py +++ b/pandas/tests/reshape/test_reshape.py @@ -454,7 +454,7 @@ def test_dataframe_dummies_preserve_categorical_dtype(self, dtype): tm.assert_frame_equal(result, expected) - def test_get_dummies_sparsify_all_columns(self): + def test_get_dummies_dont_sparsify_all_columns(self): # GH18914 df = DataFrame.from_items([('GDP', [1, 2]), ('Nation', ['AB', 'CD'])]) df = get_dummies(df, columns=['Nation'], sparse=True) diff --git a/pandas/tests/sparse/test_array.py b/pandas/tests/sparse/test_array.py index 682d741c9a02cd..8de93ff3209613 100644 --- a/pandas/tests/sparse/test_array.py +++ b/pandas/tests/sparse/test_array.py @@ -465,7 +465,7 @@ def test_to_dense(self): with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): SparseArray(vals).to_dense(fill=2) - + def test_getitem(self): def _checkit(i): assert_almost_equal(self.arr[i], self.arr.values[i]) diff --git a/pandas/tests/sparse/test_frame.py b/pandas/tests/sparse/test_frame.py index 7185b8096c57bd..4b9d6621a20fbd 100644 --- a/pandas/tests/sparse/test_frame.py +++ b/pandas/tests/sparse/test_frame.py @@ -322,6 +322,9 @@ def test_density(self): assert df.density == 0.75 + def test_sparse_to_dense(self): + pass + def test_sparse_series_ops(self): self._check_frame_ops(self.frame)