Python package ismember returns array elements that are members of set array.
Project description
ismember
ismember
is a Python library that checks whether the elements in X is present in Y.
⭐️ Star this repo if you like it ⭐️
Documentation pages
On the documentation pages you can find more information about ismember
with examples.
Install bnlearn from PyPI
pip install ismember # normal install
pip install -U ismember # update if needed
Import ismember package
from ismember import ismember
Example: Check whether the elements of X are present in Y
Example: Determine the corresponding location of the values that are present in Y array
Example: Row wise comparison
Example: Elementwise comparison
Quick examples
import numpy as np
from ismember import ismember
# Example with lists
a_vec = [1,2,3,None]
b_vec = [4,1,2]
[I,idx] = ismember(a_vec,b_vec)
np.array(a_vec)[I]
np.array(b_vec)[idx]
# Example with DataFrames
a_vec = pd.DataFrame(['aap','None','mies','aap','boom','mies',None,'mies','mies','pies',None])
b_vec = pd.DataFrame([None,'mies','mies','pies',None])
I, idx = ismember(a_vec,b_vec)
a_vec.values[I]
b_vec.values[idx]
# Example with Numpy array
a_vec = np.array(['boom','aap','mies','aap'])
b_vec = np.array(['aap','boom','aap'])
I, idx = ismember(a_vec,b_vec)
a_vec[I]
b_vec[idx]
References
Maintainer
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ismember-1.0.1.tar.gz
(6.5 kB
view hashes)