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.

Files for ismember, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size ismember-0.1.2-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ismember-0.1.2.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page