Installation - Polars user guide (original) (raw)

Polars is a library and installation is as simple as invoking the package manager of the corresponding programming language.

Python Rust

`pip install polars

Or for legacy CPUs without AVX2 support

pip install polars-lts-cpu `

`cargo add polars -F lazy

Or Cargo.toml

[dependencies] polars = { version = "x", features = ["lazy", ...]} `

Big Index

By default, Polars dataframes are limited to \(2^{32}\) rows (~4.3 billion). Increase this limit to\(2^{64}\) (~18 quintillion) by enabling the big index extension:

Python Rust

pip install polars-u64-idx

`cargo add polars -F bigidx

Or Cargo.toml

[dependencies] polars = { version = "x", features = ["bigidx", ...] } `

Legacy CPU

To install Polars for Python on an old CPU withoutAVX support, run:

Python

pip install polars-lts-cpu

Importing

To use the library, simply import it into your project:

Feature flags

By using the above command you install the core of Polars onto your system. However, depending on your use case, you might want to install the optional dependencies as well. These are made optional to minimize the footprint. The flags are different depending on the programming language. Throughout the user guide we will mention when a functionality used requires an additional dependency.

Python

# For example pip install 'polars[numpy,fsspec]'

All

Tag Description
all Install all optional dependencies.

GPU

Tag Description
gpu Run queries on NVIDIA GPUs.

Note

See GPU support for more detailed instructions and prerequisites.

Interoperability

Tag Description
pandas Convert data to and from pandas dataframes/series.
numpy Convert data to and from NumPy arrays.
pyarrow Convert data to and from PyArrow tables/arrays.
pydantic Convert data from Pydantic models to Polars.

Excel

Tag Description
calamine Read from Excel files with the calamine engine.
openpyxl Read from Excel files with the openpyxl engine.
xlsx2csv Read from Excel files with the xlsx2csv engine.
xlsxwriter Write to Excel files with the XlsxWriter engine.
excel Install all supported Excel engines.

Database

Tag Description
adbc Read from and write to databases with the Arrow Database Connectivity (ADBC) engine.
connectorx Read from databases with the ConnectorX engine.
sqlalchemy Write to databases with the SQLAlchemy engine.
database Install all supported database engines.

Cloud

Tag Description
fsspec Read from and write to remote file systems.

Other I/O

Tag Description
deltalake Read from and write to Delta tables.
iceberg Read from Apache Iceberg tables.

Other

Tag Description
async Collect LazyFrames asynchronously.
cloudpickle Serialize user-defined functions.
graph Visualize LazyFrames as a graph.
plot Plot dataframes through the plot namespace.
style Style dataframes through the style namespace.
timezone Timezone support1.

Rust

# Cargo.toml [dependencies] polars = { version = "0.26.1", features = ["lazy", "temporal", "describe", "json", "parquet", "dtype-datetime"] }

The opt-in features are: