Skip to content

Commit 74fdc68

Browse files
committed
add take
1 parent a0ce360 commit 74fdc68

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/pint_array/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,13 @@ def fun(x1, x2, /, *args, func_str=func_str, **kwargs):
584584

585585
setattr(mod, func_str, fun)
586586

587+
## Indexing Functions
588+
def take(x, indices, /, **kwargs):
589+
magnitude = xp.take(x.magnitude, indices.magnitude, **kwargs)
590+
return ArrayUnitQuantity(magnitude, x.units)
591+
592+
mod.take = take
593+
587594
def get_linalg_fun(func_str):
588595
def linalg_fun(x1, x2, /, **kwargs):
589596
x1 = asarray(x1)

0 commit comments

Comments
 (0)