Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pint/facets/numpy/numpy_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,12 @@ def _where(condition, *args):
return output_wrap(np.where(condition, *args))


@implements("repeat", "function")
def _repeat(a, repeats, axis=None):
a, output_wrap = unwrap_and_wrap_consistent_units(a)
return output_wrap(np.repeat(a, repeats, axis))


@implements("concatenate", "function")
def _concatenate(sequence, *args, **kwargs):
sequence, output_wrap = unwrap_and_wrap_consistent_units(*sequence)
Expand Down
3 changes: 3 additions & 0 deletions pint/testsuite/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ def test_repeat(self):
helpers.assert_quantity_equal(
self.q.repeat(2), [1, 1, 2, 2, 3, 3, 4, 4] * self.ureg.m
)
helpers.assert_quantity_equal(
np.repeat(self.q, 2), [1, 1, 2, 2, 3, 3, 4, 4] * self.ureg.m
)

def test_sort(self):
q = [4, 5, 2, 3, 1, 6] * self.ureg.m
Expand Down