Skip to main content

Transform string-based expressions into Polars DataFrame operations

Project description

Polars Expression Transformer

Polars Expression Transformer is a Python library that provides a simple and intuitive way to transform and manipulate data using Polars expressions. It is designed for users who are familiar with SQL and Tableau and want to leverage the power of Polars for data processing tasks.

Purpose

The purpose of Polars Expression Transformer is to provide a high-level interface for working with Polars expressions. It allows users to write simple string expressions that can be easily translated into Polars expressions, making it easy to perform complex data transformations without having to write Python code.

Target Group

Polars Expression Transformer is ideal for users who:

  • Are familiar with SQL or Tableau and want to use Polars for data transformation tasks.
  • Want to perform complex data transformations without having to write Python code.
  • Need to integrate Polars into an application or tool and want to provide a simple and intuitive interface for users to perform data transformations.

When to Use

Polars Expression Transformer is particularly useful in the following scenarios:

  • When you are not directly exposed to Python, for example in an application.
  • When you want to provide a simple and intuitive interface for users to perform complex data transformations without having to write Python code.

When Not to Use

Polars Expression Transformer may not be the best choice for users who:

  • Are already familiar with Polars and are developing in an IDE. In this case, it may be more efficient to write Polars expressions directly.
  • Want to have the best performance and all features of Polars. Polars Expression Transformer adds an additional layer on top of Polars, which may result in a performance overhead.
  • Need to perform low-level optimizations or custom transformations that are not supported by Polars Expression Transformer

Installation

To install Polars Expression Transformer, you can use pip:

pip install polars-expr-transformer

Examples

Let's say you have a Polars DataFrame df with columns "names" and "subnames", and you want to create a new column "combined" that concatenates the values in "names" and "subnames" with a space in between.

Without Polars Expression Transformer, you would need to write Python code to accomplish this:

df = df.with_column(pl.col("names") + " " + pl.col("subnames").alias("combined"))

With Polars Expression Transformer, you can write a simple string expression instead:

from polars_expr_transformer.process.polars_expr_transformer import simple_function_to_expr

df = df.select(simple_function_to_expr('concat([names], " ", [subnames])').alias("combined"))

This makes it easy to perform complex data transformations without having to write Python code.

Built on Polars

Polars Expression Transformer is built on top of the amazing Polars library. Polars is a blazing fast DataFrame library implemented in Rust and Python. It is designed to be a high-performance alternative to Pandas and other DataFrame libraries. I highly recommend checking out Polars if you are working with large datasets or need to perform complex data transformations quickly.

Acknowledgements

We would like to thank the Polars team for creating such an amazing library.

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.4.3.0.tar.gz (25.9 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.4.3.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: polars_expr_transformer-0.4.3.0.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.11 Linux/6.8.0-1021-azure

File hashes

Hashes for polars_expr_transformer-0.4.3.0.tar.gz
Algorithm Hash digest
SHA256 7130b4ff6580035f61b1218efb0c824b6f17f1e191d9d2d7bab735ea0f2e9f04
MD5 973e1307792370e73f2b465d10f55fcf
BLAKE2b-256 1f0cabbdb7718a60b597c68ce43b7430d87da87972b5aec64b8c0c75a1d7f50b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polars_expr_transformer-0.4.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b5cb3f2ae0caaade368d7f716adb313f75a3380fbe40f65942280f0abf43a01
MD5 d6b31f5c6ba04de383013b194a8718b0
BLAKE2b-256 f1e6586a735fc48a909e4638e4ae3d91cbcfe6e5f1562b1aff1b8ff9782a8e23

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