API: SparseSeries comparison now returns sparse #13999

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Member

sinhrks commented Aug 14, 2016

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

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.

sinhrks added this to the 0.19.0 milestone Aug 14, 2016

codecov-io commented Aug 14, 2016 edited

Current coverage is 85.25% (diff: 100%)

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

@@             master     #13999   diff @@
==========================================
  Files           139        139          
  Lines         50380      50384     +4   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          42953      42955     +2   
- Misses         7427       7429     +2   
  Partials          0          0          

Powered by Codecov. Last update 453bc26...eafc94c

@jreback jreback commented on an outdated diff Aug 15, 2016

doc/source/whatsnew/v0.19.0.txt
@@ -762,6 +762,8 @@ Note that the limitation is applied to ``fill_value`` which default is ``np.nan`
ValueError: unable to coerce current fill_value nan to int64 dtype
- Subclassed ``SparseDataFrame`` and ``SparseSeries`` now preserve class types when slicing or transposing. (:issue:`13787`)
+- ``SparseSeries`` comparison now changed to return ``SparseSeries`` (:issue:`13999`)
@jreback

jreback Aug 15, 2016

Contributor

can you give a mini-example for this one

@jreback jreback commented on an outdated diff Aug 15, 2016

doc/source/whatsnew/v0.19.0.txt
@@ -771,6 +773,7 @@ Note that the limitation is applied to ``fill_value`` which default is ``np.nan`
- Bug in ``SparseSeries.abs`` incorrectly keeps negative ``fill_value`` (:issue:`13853`)
- Bug in single row slicing on multi-type ``SparseDataFrame``s, types were previously forced to float (:issue:`13917`)
- Bug in sparse indexing using ``SparseArray`` with ``bool`` dtype may return incorrect result (:issue:`13985`)
+- Bug in ``SparseArray`` creatd from ``SparseSeries`` may lose ``dtype`` (:issue:`13999`)
@jreback

jreback Aug 15, 2016

Contributor

created

@jreback jreback commented on an outdated diff Aug 15, 2016

doc/source/whatsnew/v0.19.0.txt
@@ -762,6 +762,8 @@ Note that the limitation is applied to ``fill_value`` which default is ``np.nan`
ValueError: unable to coerce current fill_value nan to int64 dtype
- Subclassed ``SparseDataFrame`` and ``SparseSeries`` now preserve class types when slicing or transposing. (:issue:`13787`)
+- ``SparseSeries`` comparison now changed to return ``SparseSeries`` (:issue:`13999`)
+
@jreback

jreback Aug 15, 2016

Contributor

are you adding tests for this specifically?

@jreback jreback commented on an outdated diff Aug 18, 2016

pandas/sparse/tests/test_array.py
@@ -102,6 +102,29 @@ def test_constructor_spindex_dtype(self):
self.assertEqual(arr.dtype, np.int64)
self.assertEqual(arr.fill_value, 0)
+ def test_sparseseries_roundtrip(self):
+ # GH 13999
+ for kind in ['integer', 'block']:
+ for fill in [1, np.nan, 0]:
+ arr = SparseArray([np.nan, 1, np.nan, 2, 3])
@jreback

jreback Aug 18, 2016

Contributor

are these supposed to use kind/fill?

@sinhrks sinhrks API: SparseSeries comparison now returns sparse
eafc94c
Contributor

jreback commented Aug 20, 2016

thanks!

jreback closed this in 51b20de Aug 20, 2016

sinhrks deleted the sinhrks:sparse_comparison branch Aug 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment