Skip to main content

Python package ismember returns array elements that are members of set array.

Project description

ismember

Python PyPI Version License Downloads Downloads Sphinx

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

  • Erdogan Taskesen, github: erdogant
  • Contributions are welcome.
  • If you wish to buy me a Coffee for this work, it is very appreciated :)

Project details


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 details)

Uploaded Source

Built Distribution

ismember-1.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file ismember-1.0.1.tar.gz.

File metadata

  • Download URL: ismember-1.0.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for ismember-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a36ebb9e220b9f07991b3251b81d9635663ad6a298050c9ece9e317e6b1b37c3
MD5 13b6ed18a23c6000a4efd6c7f025218e
BLAKE2b-256 4655b8ddb2562be940b828b05b54608ec720bc00bd28d1f23f74cc8cdb287da2

See more details on using hashes here.

File details

Details for the file ismember-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ismember-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for ismember-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 622a9c69ae1bffd33886f3fa2dd9271b580d0266ecbb14d51345d7791a019f81
MD5 9e913e04ffd574704d9551f6cc333bfc
BLAKE2b-256 3e5f557285693ee4b1efb3fdbe831f4b66a2c4b4fa243e5b01f8fb7e3005359f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page