Skip to main content

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

Project description

ismember

Python PyPI Version License Downloads

  • 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

import ismember as 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.

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

Uploaded Source

Built Distribution

ismember-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ismember-0.1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for ismember-0.1.1.tar.gz
Algorithm Hash digest
SHA256 03db47869d007c7105b8f81fac00ac92d37b3c4767ea105a8a938ad58651d426
MD5 074cf711d15aeadc64234ad12829183a
BLAKE2b-256 7693fe690d2341150aeea0d589c974307e81d0d27f18f78919d2a09669239857

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ismember-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5

File hashes

Hashes for ismember-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70cb49e05318d68726cd4ebcb8e56204b8d5ca31a09e95f0a36ea27e066701c9
MD5 24fa3e2129c89ec5776eeae6b7be5052
BLAKE2b-256 324c1c80369fa78c8e4fff02e3ac6695f384c64217fab0006dbcca596948ce85

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