Skip to main content

Transude

Simple tool set for filtering DataFrames (Pandas or Polars*) by building queries from one or more filters.
This is useful for connecting filtering controls on DataFrames using touch screen controls.

This project was developed with some consulting from ChatGPT. There were a few concepts I didn't understand until I had someone I could point more specific questions towards and see working examples. Most of the scaffolding was written before consulting ChatGPT which really helps to speed up responses and keep the conversation on track.

This is also a refactor of old code I wrote in a recent project.

Installation:

pip install transude

Usage:

import pandas as pd
import transude as txd

# Create a DataFrame using Pandas
pd_df = pd.DataFrame(...)

# Get a filtered version of the DataFrame using Transude
filtered_pd_df = \
    txd.filter_df(data_frame=pd_df, columns='col1', values=['val1', 'val2'], operator='==', joiner='or')

If you need to manage the DataFrameFilters directly, you can use a DataFrameFilterManager like so:

pd_df_filter_manager = DataFrameFilterManager()

"""
Example of adding a single DataFrameFilter and clearing the filters.  Filters can be removed one by one as well.
"""
pd_df_filter_manager.add_filter(DataFrameFilter(columns='col1', values='val1', operator='==', joiner='or'))
pd_df_filter_manager.clear_filters()

"""
The following utilizes the DataFrameFilterFactory to create multiple filters and then adds them all to the builder.
"""
pd_filter_factory = DataFrameFilterFactory(columns='col1', values=['val1', 'val2'], operator='==', joiner='or')
pd_filters = pd_filter_factory.create_filters()
pd_df_filter_manager.add_filters(pd_filters)
query_string = pd_df_filter_manager.build_query()

# In order to apply the filters, call query using the query_string
pd_df.query(query_string)

--*Polars compatability coming soon.

Metadata

Release files for transude 2.0.0

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

Source distribution (sdist)

Source distribution for transude 2.0.0
File Size Uploaded Provenance
transude-2.0.0.tar.gz 10.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for transude 2.0.0
File Interpreter ABI Platform
transude-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / transude-2.0.0.tar.gz

Download URL transude-2.0.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
db59c29fffc3717bb537b320724b31d711393f4b729385b421a047d8afb5ceab
BLAKE2b-256 checksum
How to use checksums
b27e55795a9bec8d1819e1299e5f81c355ad7b66dc471284fa096096145fb4ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / transude-2.0.0-py3-none-any.whl

Download URL transude-2.0.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fef68f55800868f81999441202551a7b782747f2b63c0814be2d84cbd49d3c69
BLAKE2b-256 checksum
How to use checksums
c3fdcd2f834e0ee426a152c8ad736390885485b920e8dfd5dcefc788fa7c5555
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for transude 2.0.0

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