Skip to content

Commit

Permalink
doc: output in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
leuraph authored and erdogant committed Apr 21, 2024
1 parent 1b5e93b commit 444a9e6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ismember/ismember.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@ def ismember(a_vec, b_vec, method=None):
Array containing the lowest index in B for each value in A that is
a member of B.
Example
-------
>>> a_vec = np.array([1,2,3,None])
Examples
--------
>>> a_vec = np.array([1,2,3])
>>> b_vec = np.array([4,1,2])
>>> Iloc, idx = ismember(a_vec,b_vec)
>>> a_vec[Iloc] == b_vec[idx]
>>>
>>> Iloc
array([ True, True, False])
>>> idx
array([1, 2])
>>> # Row wise comparison
>>> a_vec = np.array(((1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12)))
>>> b_vec = np.array(((4, 5, 6), (7, 8, 0)))
>>> Iloc, idx = ismember(a_vec, b_vec, 'rows')
>>> a_vec[Iloc]==b_vec[idx]
>>> idx
array([0])
>>> Iloc
array([False, True, False, False])
References
----------
Expand Down

0 comments on commit 444a9e6

Please sign in to comment.