{"id":5682,"library":"polars-lts-cpu","title":"Polars (LTS CPU version)","description":"Polars is a blazingly fast DataFrame library for Python, implemented in Rust, designed for performance-critical data manipulation. The `polars-lts-cpu` package specifically provides a long-term support (LTS), CPU-only build of Polars, ensuring stability and a smaller installation footprint without GPU dependencies. It generally follows a slower release cadence than the main `polars` package, focusing on reliability. The current version is 1.33.1.","status":"active","version":"1.33.1","language":"en","source_language":"en","source_url":"https://github.com/pola-rs/polars","tags":["dataframe","data processing","performance","cpu-only","lts"],"install":[{"cmd":"pip install polars-lts-cpu","lang":"bash","label":"Install Polars LTS CPU"}],"dependencies":[{"reason":"Often used for optimized I/O operations (e.g., Parquet, IPC, Feather) and better interoperability with other data tools.","package":"pyarrow","optional":true}],"imports":[{"note":"The standard and recommended import alias.","symbol":"polars","correct":"import polars as pl"},{"symbol":"DataFrame","correct":"pl.DataFrame"},{"symbol":"LazyFrame","correct":"pl.LazyFrame"},{"symbol":"Series","correct":"pl.Series"},{"symbol":"col","correct":"pl.col"},{"symbol":"lit","correct":"pl.lit"}],"quickstart":{"code":"import polars as pl\n\n# Create a DataFrame\ndf = pl.DataFrame(\n    {\n        \"name\": [\"Alice\", \"Bob\", \"Charlie\", \"David\", \"Eve\"],\n        \"age\": [25, 30, 35, 28, 22],\n        \"city\": [\"New York\", \"London\", \"Paris\", \"New York\", \"London\"],\n        \"score\": [90, 85, 92, 78, 95],\n    }\n)\n\n# Perform some operations: filter and group by city, then calculate average score\nresult = (\n    df.filter(pl.col(\"age\") > 25)\n    .group_by(\"city\")\n    .agg(\n        pl.col(\"score\").mean().alias(\"average_score\"),\n        pl.col(\"name\").count().alias(\"num_people\"),\n    )\n    .sort(\"average_score\", descending=True)\n)\n\nprint(\"Original DataFrame:\\n\", df)\nprint(\"\\nProcessed Result:\\n\", result)","lang":"python","description":"This quickstart demonstrates creating a Polars DataFrame, filtering rows based on a condition, grouping data by a categorical column, aggregating results (mean and count), and finally sorting the output. It showcases basic eager DataFrame operations."},"warnings":[{"fix":"Be explicit about which Polars package you intend to install. Use `polars-lts-cpu` for stable, CPU-only environments. Use `polars` (and potentially its extras like `polars[pyarrow]`) for the latest features and potentially GPU support.","message":"The `polars-lts-cpu` package is distinct from the main `polars` package. `polars-lts-cpu` provides a CPU-only, long-term support version that often trails the latest features and versions of the main `polars` package. Installing the wrong package can lead to unexpected features, performance, or dependencies.","severity":"gotcha","affected_versions":"All `polars-lts-cpu` versions."},{"fix":"Understand the Polars execution model. For complex pipelines, convert your DataFrame to a LazyFrame using `.lazy()` and call `.collect()` at the end of the chain to trigger computation. E.g., `df.lazy().filter(...).group_by(...).collect()`.","message":"Polars strongly differentiates between eager (DataFrame) and lazy (LazyFrame) execution. Operations on a `DataFrame` are executed immediately, while `LazyFrame` operations are chained and only computed upon calling `.collect()`. Mixing these paradigms or expecting lazy behavior from an eager DataFrame is a common source of error.","severity":"breaking","affected_versions":"All Polars versions."},{"fix":"If an independent copy of a DataFrame or Series is needed before modification, explicitly create one using the `.clone()` method (e.g., `df.clone()`).","message":"Polars is highly optimized to avoid unnecessary data copies, leading to 'view' semantics for many operations. This can surprise users accustomed to libraries like Pandas, where operations often create implicit copies. Modifying data derived from a view might inadvertently affect the original data if not handled carefully.","severity":"gotcha","affected_versions":"All Polars versions."}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}