Skip to main content

Transform string-based expressions into Polars DataFrame operations

Project description

polars_expr_transformer

polars_expr_transformer is a Python package designed to simplify the transformation of string-based expressions into Polars DataFrame operations. It enables users to write expressive and readable string-based functions that are automatically converted into Polars expressions for data manipulation and analysis.

Features

  • Preprocess Expressions: Preprocess string-based functions to prepare them for transformation.
  • Convert to Polars Expressions: Transform preprocessed string expressions into Polars expressions.
  • Integrate with Polars DataFrames: Easily apply transformed expressions to Polars DataFrames.

Installation

You can install the package using pip:

pip install polars_expr_transformer

Usage Here's a simplified example of how to use polars_expr_transformer:

from polars_expr_transformer.process.polars_expr_transformer import preprocess, simple_function_to_expr import polars as pl

Define a string-based function

test_func = """'abcd' in 'adbc'"""

Preprocess the function

parsed_test_func = preprocess(test_func)

Create a Polars DataFrame

df = pl.from_dicts([{'a': 'edward', 'b': 'courtney'}, {'a': 'courtney', 'b': 'edward'}])

Apply the transformed expressions to the DataFrame

print(df.select(simple_function_to_expr("'hallo world'"))) License This project is licensed under the MIT License. See the LICENSE file for more details.

Contact For any questions or inquiries, please contact me.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polars_expr_transformer-0.1.2.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polars_expr_transformer-0.1.2-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file polars_expr_transformer-0.1.2.tar.gz.

File metadata

  • Download URL: polars_expr_transformer-0.1.2.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.0

File hashes

Hashes for polars_expr_transformer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2b2d060e257253daffe4bd861ff6c2f56d587973cef347530954df61064cdd0e
MD5 d003dda12a4182207e07eb5ef7ffae25
BLAKE2b-256 30e8b5a124517b8f4979dc00a8c14c2c65e33a77f1a3dd34d0d0bc2ad7c9742e

See more details on using hashes here.

File details

Details for the file polars_expr_transformer-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for polars_expr_transformer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 837d390beda069c3480ea91c3347128bf87d8135e894d40969e897be7667f2a5
MD5 1541f966d2adc240ac706be8d71ed9a2
BLAKE2b-256 209f512b5326ce6ba6434d0c4bbce2b8746c6dac4c709acead7c9c171760ef62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page