Skip to main content

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.

Installation

pip install pandas-sets

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

import pandas_sets

Examples

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.add('data')

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

pandas_posts.tags.set.len()

Notes

  • 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.

Metadata

Release files for pandas-sets 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pandas-sets 0.2.1
File Size Uploaded Provenance Actions
pandas-sets-0.2.1.tar.gz 4.1 kB Without provenance Details for pandas-sets-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pandas-sets 0.2.1
File Interpreter ABI Platform Actions
pandas_sets-0.2.1-py3-none-any.whl Python 3 none any Details for pandas_sets-0.2.1-py3-none-any.whl

Total release size: 9.7 kB

Release files / pandas-sets-0.2.1.tar.gz

Download URL pandas-sets-0.2.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
00beeaa5c9d584e45b4bf8631e4e0d95df53391174b43e6d9ddfbeff56220f29
BLAKE2b-256 checksum
How to use checksums
9a08494999359d150cb0df421c9afe656b24d2ba85c1f0d756d7ee5b73477902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / pandas_sets-0.2.1-py3-none-any.whl

Download URL pandas_sets-0.2.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dc348525352326c9f5f93bd46b3df39e3073b1ec55a085dc67216c4d45a7dc0
BLAKE2b-256 checksum
How to use checksums
ce0ec8c49b34f2cc4e429e84dd717f6475f350dca2254c005cd5e411593cab68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Security for pandas-sets 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page