Skip to main content

Pandas - Sets: Set-oriented Operations in Pandas

Project description

Pandas Sets: Set-oriented Operations in Pandas

If you store standard Python sets or frozensets in your Series or DataFrame objects, you'll find this useful.

The pandas_sets package adds a .set accessor to any pandas Series object; it's like .dt for datetime or .str for string, but for set.

It exposes all public methods available in the standard set.


pip install pandas-sets

Just import the pandas_sets package and it will register a .set accessor to any Series object.

import pandas_sets


import pandas_sets
import pandas as pd
df = pd.DataFrame({'post': [1, 2, 3, 4],
                    'tags': [{'python', 'pandas'}, {'philosophy', 'strategy'}, {'scikit-learn'}, {'pandas'}]

pandas_posts = df[df.tags.set.contains('pandas')]


pandas_posts.tags.set.update({'data', 'analysis'})



  • The implementation is primitive for now. It's based heavily on the pandas' core StringMethods implementation.
  • The public API has been tested for most expected scenarios.
  • The API will need to be extended to handle NA values appropriately.

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 pandas-sets, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size pandas_sets-0.2.1-py3-none-any.whl (5.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pandas-sets-0.2.1.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page