Skip to main content

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

Project description

ismember

Python PyPI Version License Downloads Donate

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

Contents

Installation

  • Install ismember from PyPI (recommended). ismember is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
  • It is distributed under the MIT license.

Requirements

pip install numpy

## Quick Start

pip install ismember

* Alternatively, install ismember from the GitHub source:
```bash
git clone https://github.com/erdogant/ismember.git
cd ismember
python setup.py install

Import ismember package

from ismember import ismember

Example:

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]

a_vec   = np.array([1,2,3,None])
b_vec   = np.array([1,2,4])
[I,idx] = ismember(a_vec,b_vec)
a_vec[I]
b_vec[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

Maintainers

Contribute

  • Contributions are welcome.

Licence

See LICENSE for details.

Donation

  • This package is created and maintained in my free time. If this package is usefull, you can show your gratitude :) Thanks!

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-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

ismember-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ismember-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.10

File hashes

Hashes for ismember-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7e24d199cd98ae67a2316407789996c667350123cc15ce8d4865494f8da8069d
MD5 f6e107b0e5aacc28199e64ed478052a3
BLAKE2b-256 5bc5d222dc8139da11eec47b559e8b8d79d6df330169507fd0b76dcb5bff07ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ismember-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.6.10

File hashes

Hashes for ismember-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 295c3172092f3cf12bcf90f70ac2d24417a319d5bb7ac5efcd7dc1039e15f2b7
MD5 3395491391641dadae79ff95a5f8a61e
BLAKE2b-256 d8a85197c318bc2edc4ede85f0169ab65cc4c9f3eed7bf91639759cdb0ccc8fa

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