polars

Fast in-memory DataFrame library for datasets that fit in RAM. Use when pandas is too slow but data still fits in memory. Lazy evaluation, parallel execution, Apache Arrow backend. Best for 1-100GB datasets, ETL pipelines, faster pandas replacement. For larger-than-RAM data use dask or vaex.

Install

Hot:7

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=k-dense-ai-scientific-skills-polars&locale=en&source=copy

Polars - High-Performance Python DataFrame Library

Skill Overview


Polars is a high-speed in-memory DataFrame library built on Apache Arrow, designed for 1–100GB datasets, providing faster data processing performance than pandas.

Use Cases

1. Alternative when pandas performance is insufficient


When processing medium to large datasets (1–100GB), pandas' speed and memory efficiency can become a bottleneck. Polars delivers significantly higher performance through lazy evaluation, parallel execution, and an Apache Arrow backend, while keeping a concise API. It is especially suitable for ETL pipelines, data cleaning, and batch data processing tasks.

2. When high-performance data processing and transformation are needed


Polars' expression API and lazy evaluation framework make complex data transformations more efficient. It supports data filtering, aggregation, window functions, join operations, etc., and can automatically optimize query plans. Suitable for data analysis, feature engineering, report generation, and other scenarios that require extensive data operations.

3. Migrating from pandas to a faster DataFrame framework


For users familiar with pandas but needing better performance, Polars provides a similar DataFrame operation model while addressing pandas' performance limitations. It supports common data formats (CSV, Parquet, JSON, Excel) and can be seamlessly integrated into existing data workflows.

Core Features

1. Expression API and lazy evaluation


Polars adopts an expression-centered API design where all operations are built using pl.col() expressions. Lazy evaluation (LazyFrame) allows the entire query plan to be optimized before execution, including predicate pushdown, projection pushdown, and other optimization strategies. This means complex data operations can be executed in an optimal manner, significantly improving performance.

2. High-performance data processing operations


Provides a complete set of data processing tools: filtering (filter), column selection (select), group aggregation (group_by), window functions (over), joins (join), pivot/unpivot, and more. All operations are executed in parallel by default, making full use of multi-core CPU performance.

3. Multi-format data I/O support


Supports reading and writing various data formats, including CSV, Parquet, JSON, Excel, and more. Parquet is particularly recommended because it offers the best read/write performance and compression. Supports reading data from cloud storage (S3, Azure, GCS) and databases, making it easy to integrate with various data sources.

Frequently Asked Questions

What's the difference between Polars and pandas? Which is faster?


The main differences between Polars and pandas are: Polars uses lazy evaluation and parallel execution and is built on Apache Arrow, whereas pandas executes eagerly and is primarily single-threaded. In most operations, Polars is 5–10x faster than pandas, especially on large datasets and complex queries. Polars also has no concept of indexes, a stricter type system, and a more consistent API design.

What size data is Polars suitable for?


Polars is best suited for in-memory datasets of 1–100GB. For data smaller than 1GB, pandas may be sufficient and has a more mature ecosystem. For datasets larger than 100GB or exceeding memory, frameworks supporting distributed or out-of-core processing like Dask or Vaex are recommended. Polars also supports a streaming processing mode (streaming=True) that can handle data slightly larger than memory with limited memory.

How do I migrate from pandas to Polars?


The migration process is relatively smooth because both use a DataFrame operation model. Main differences include: selecting columns uses select() instead of df["col"], filtering uses filter() instead of boolean indexing, adding columns uses with_columns() instead of assign(), and grouping uses group_by() instead of groupby(). Polars' expression API requires some adaptation but is more consistent and composable. It is recommended to start with small projects and gradually migrate; once you are familiar with the expression API, tackle more complex scenarios.