Skip to content

Commit 9565fc7

Browse files
committed
ENH: SparseSeries binary op speed enhancement in the block case, address GH #205
1 parent f0b0f15 commit 9565fc7

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

RELEASE.rst

+7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ pandas 0.4.3
1010

1111
**Release date:** not yet released
1212

13+
This is largely a bugfix release from 0.4.2 but also includes a handful of new
14+
and enhanced features. Also, pandas can now be installed and used on Python 3!
15+
1316
**New features / modules**
1417

18+
- Python 3 support using 2to3 (PR #200, Thomas Kluyver)
1519
- Add `name` attribute to standard Index so that stacking / unstacking does
1620
not discard names and so that indexed DataFrame objects can be reliably
1721
round-tripped to flat files, pickle, HDF5, etc.
@@ -22,6 +26,9 @@ pandas 0.4.3
2226
- Skip xlrd-related unit tests if not installed
2327
- `Index.append` and `MultiIndex.append` can accept a list of Index objects to
2428
concatenate together
29+
- Altered binary operations on differently-indexed SparseSeries objects to use
30+
the integer-based (dense) alignment logic which results in more than 10x
31+
speedup over the block logic. Have not figured out why this is yet (GH #205)
2532

2633
**Bug fixes**
2734

pandas/src/sparse.pyx

+10-6
Original file line numberDiff line numberDiff line change
@@ -747,12 +747,16 @@ cpdef sparse_nanpow(ndarray x, SparseIndex xindex,
747747
cdef inline tuple sparse_nancombine(ndarray x, SparseIndex xindex,
748748
ndarray y, SparseIndex yindex,
749749
double_func op):
750-
if isinstance(xindex, BlockIndex):
751-
return block_nanop(x, xindex.to_block_index(),
752-
y, yindex.to_block_index(), op)
753-
elif isinstance(xindex, IntIndex):
754-
return int_nanop(x, xindex.to_int_index(),
755-
y, yindex.to_int_index(), op)
750+
# block_nanop is up to 40x slower and I don't know why yet
751+
return int_nanop(x, xindex.to_int_index(),
752+
y, yindex.to_int_index(), op)
753+
754+
# if isinstance(xindex, BlockIndex):
755+
# return block_nanop(x, xindex.to_block_index(),
756+
# y, yindex.to_block_index(), op)
757+
# elif isinstance(xindex, IntIndex):
758+
# return int_nanop(x, xindex.to_int_index(),
759+
# y, yindex.to_int_index(), op)
756760

757761
cpdef sparse_add(ndarray x, SparseIndex xindex, float64_t xfill,
758762
ndarray y, SparseIndex yindex, float64_t yfill):

0 commit comments

Comments
 (0)