Permalink
Browse files

ENH larry.take() is now faster.

  • Loading branch information...
1 parent cd7e39d commit 3ebccae61e53b9446dbe67c88d063b0d5e8f687f @kwgoodman committed Mar 27, 2012
Showing with 8 additions and 6 deletions.
  1. +3 −4 RELEASE.rst
  2. +5 −2 la/deflarry.py
View
@@ -16,11 +16,10 @@ la 0.7
- Indexing into larrys with scalars, slices, and 1d numpy arrays
- Binary functions (+, -, / , &, ...) for unaligned larrys
- la.align(), la.add(), la.subtract(), etc for unaligned larrys
-- la.union(), la.intersection()
-- la.align_axis()
+- la.union(), la.intersection(), la.align_axis()
- la.farray.correlation(arr1, arr2, axis) for numpy arrays
-- larry.morph(), larry.morph_like()
-- larry.merge() when update=True
+- larry.merge() when update=True, larry.morph(), larry.morph_like()
+- larry.take()
**Breakage from la 0.6**
View
@@ -1799,9 +1799,12 @@ def take(self, indices, axis):
"""
label = self.copylabel()
labelaxis = label[axis]
- label[axis] = [labelaxis[idx] for idx in indices]
+ lab = [labelaxis[idx] for idx in indices]
+ if len(set(lab)) != len(lab):
+ raise IndexError("`indices` must be unique")
+ label[axis] = lab
x = self.x.take(indices, axis)
- return larry(x, label)
+ return larry(x, label, validate=False)
@property
def lix(self):

0 comments on commit 3ebccae

Please sign in to comment.