BUG: Sparse indexing with bool sparse may be incorrect #13985

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Member

sinhrks commented Aug 13, 2016

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

indexing with SparseArray with bool dtype may return incorrect result because of some internal conversions.

arr = pd.SparseArray([1, 2, 3])
indexer = pd.SparseArray([True, False, True], fill_value=False, dtype=bool)

# NG
arr[indexer]
# [2.0, 2.0]
# Fill: nan
# IntIndex
# Indices: array([0, 1], dtype=int32)

# Expected (after this PR)
arr[indexer]
# [1.0, 3.0]
# Fill: nan
# IntIndex
# Indices: array([0, 1], dtype=int32)
@sinhrks sinhrks BUG: Sparse indexing with bool sparse may be incorrect
0909fa8

sinhrks added this to the 0.19.0 milestone Aug 13, 2016

codecov-io commented Aug 13, 2016 edited

Current coverage is 85.28% (diff: 83.33%)

Merging #13985 into master will decrease coverage by <.01%

@@             master     #13985   diff @@
==========================================
  Files           139        139          
  Lines         50206      50211     +5   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          42818      42822     +4   
- Misses         7388       7389     +1   
  Partials          0          0          

Powered by Codecov. Last update 29d9e24...0909fa8

sinhrks referenced this pull request Aug 13, 2016

Merged

ENH: Sparse int64 and bool dtype support enhancement #13849

4 of 4 tasks complete

jreback closed this in 1f88312 Aug 13, 2016

Contributor

jreback commented Aug 13, 2016

thanks!

sinhrks deleted the sinhrks:sparse_bool_indexing branch Aug 13, 2016

sinhrks referenced this pull request Aug 14, 2016

Closed

API: SparseSeries comparison now returns sparse #13999

3 of 3 tasks complete

@jreback jreback added a commit that referenced this pull request Aug 20, 2016

@sinhrks @jreback sinhrks + jreback API: SparseSeries comparison now returns sparse
Because #13985 has been fixed, ``SparseSeries`` comparison op now can return
``SparseSeries`` (it returns normal ``Series`` on current master).
also fixed a bug when ``SparseArray`` created from ``SparseSeries``
may not inherit ``dtype``.

Author: sinhrks <sinhrks@gmail.com>

Closes #13999 from sinhrks/sparse_comparison and squashes the following commits:

eafc94c [sinhrks] API: SparseSeries comparison now returns sparse
51b20de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment