# Buggy code
def get_reindexed_values(self, empty_dtype, upcasted_na):
    if upcasted_na is None:
        # No upcasting is necessary
        fill_value = self.block.fill_value
        values = self.block.get_values()
    else:
        fill_value = upcasted_na

        if self.is_null:
            if getattr(self.block, "is_object", False):
                # we want to avoid filling with np.nan if we are
                # using None; we already know that we are all
                # nulls
                values = self.block.values.ravel(order="K")
                if len(values) and values[0] is None:
                    fill_value = None

            if getattr(self.block, "is_datetimetz", False):
                pass
            elif getattr(self.block, "is_categorical", False):
                pass
            else:
                missing_arr = np.empty(self.shape, dtype=empty_dtype)
                missing_arr.fill(fill_value)
                return missing_arr

        if not self.indexers:
            if not self.block._can_consolidate:
                # preserve these for validation in _concat_compat
                return self.block.values

        if self.block.is_bool:
            # External code requested filling/upcasting, bool values must
            # be upcasted to object to avoid being upcasted to numeric.
            values = self.block.astype(np.object_).values
        else:
            # No dtype upcasting is done here, it will be performed during
            # concatenation itself.
            values = self.block.get_values()

    if not self.indexers:
        # If there's no indexing to be done, we want to signal outside
        # code that this array must be copied explicitly.  This is done
        # by returning a view and checking `retval.base`.
        values = values.view()

    else:
        for ax, indexer in self.indexers.items():
            values = algos.take_nd(values, indexer, axis=ax, fill_value=fill_value)

    return values


# Traceback (AssertionError)
.
Expected:
A  B  C
0  1  0  0
1  0  0  0
2  1  0  1
3  0  0  0
Got:
A   B  C
0  1 NaN  0
1  0 NaN  0
2  1 NaN  1
3  0 NaN  0
F
======================================================================
FAIL: test_concat_sparse_to_df (__main__.TestSparseConcat)
----------------------------------------------------------------------
Traceback (most recent call last):
File "example.py", line 28, in test_concat_sparse_to_df
assert_frame_equal(C, self.expected)
File "/home/vagrant/.virtualenvs/ai-modeling/lib/python2.7/site-packages/pandas/util/testing.py", line 748, in assert_frame_equal
check_exact=check_exact)
File "/home/vagrant/.virtualenvs/ai-modeling/lib/python2.7/site-packages/pandas/util/testing.py", line 692, in assert_series_equal
assert_almost_equal(left.values, right.values, check_less_precise)
File "das/src/testing.pyx", line 58, in pandas._testing.assert_almost_equal (pandas/src/testing.c:2758)
File "das/src/testing.pyx", line 93, in pandas._testing.assert_almost_equal (pandas/src/testing.c:1843)
File "das/src/testing.pyx", line 102, in pandas._testing.assert_almost_equal (pandas/src/testing.c:2010)
AssertionError: First object is null, second isn't: nan != 0.0

----------------------------------------------------------------------
Ran 2 tests in 0.024s

FAILED (failures=1)

# Fixed code
def get_reindexed_values(self, empty_dtype, upcasted_na):
    if upcasted_na is None:
        # No upcasting is necessary
        fill_value = self.block.fill_value
        values = self.block.get_values()
    else:
        fill_value = upcasted_na

        if self.is_null:
            if getattr(self.block, "is_object", False):
                # we want to avoid filling with np.nan if we are
                # using None; we already know that we are all
                # nulls
                values = self.block.values.ravel(order="K")
                if len(values) and values[0] is None:
                    fill_value = None

            if getattr(self.block, "is_datetimetz", False):
                pass
            elif getattr(self.block, "is_categorical", False):
                pass
            elif getattr(self.block, "is_sparse", False):
                pass
            else:
                missing_arr = np.empty(self.shape, dtype=empty_dtype)
                missing_arr.fill(fill_value)
                return missing_arr

        if not self.indexers:
            if not self.block._can_consolidate:
                # preserve these for validation in _concat_compat
                return self.block.values

        if self.block.is_bool:
            # External code requested filling/upcasting, bool values must
            # be upcasted to object to avoid being upcasted to numeric.
            values = self.block.astype(np.object_).values
        else:
            # No dtype upcasting is done here, it will be performed during
            # concatenation itself.
            values = self.block.get_values()

    if not self.indexers:
        # If there's no indexing to be done, we want to signal outside
        # code that this array must be copied explicitly.  This is done
        # by returning a view and checking `retval.base`.
        values = values.view()

    else:
        for ax, indexer in self.indexers.items():
            values = algos.take_nd(values, indexer, axis=ax, fill_value=fill_value)

    return values