polars 0.13.1
pip install polars==0.13.1
Released:
Blazingly fast DataFrame library
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT
- Author: ritchie46 <ritchie46@gmail.com>
- Requires: Python >=3.7
Project description
Polars
Python Documentation | Rust Documentation | User Guide | Discord | StackOverflow
Blazingly fast DataFrames in Rust, Python & Node.js
Polars is a blazingly fast DataFrames library implemented in Rust using Apache Arrow Columnar Format as memory model.
- Lazy | eager execution
- Multi-threaded
- SIMD
- Query optimization
- Powerful expression API
- Rust | Python | ...
To learn more, read the User Guide.
>>> import polars as pl
>>> df = pl.DataFrame(
... {
... "A": [1, 2, 3, 4, 5],
... "fruits": ["banana", "banana", "apple", "apple", "banana"],
... "B": [5, 4, 3, 2, 1],
... "cars": ["beetle", "audi", "beetle", "beetle", "beetle"],
... }
... )
# embarrassingly parallel execution
# very expressive query language
>>> (
... df
... .sort("fruits")
... .select(
... [
... "fruits",
... "cars",
... pl.lit("fruits").alias("literal_string_fruits"),
... pl.col("B").filter(pl.col("cars") == "beetle").sum(),
... pl.col("A").filter(pl.col("B") > 2).sum().over("cars").alias("sum_A_by_cars"), # groups by "cars"
... pl.col("A").sum().over("fruits").alias("sum_A_by_fruits"), # groups by "fruits"
... pl.col("A").reverse().over("fruits").flatten().alias("rev_A_by_fruits"), # groups by "fruits
... pl.col("A").sort_by("B").over("fruits").flatten().alias("sort_A_by_B_by_fruits"), # groups by "fruits"
... ]
... )
... )
shape: (5, 8)
┌──────────┬──────────┬──────────────┬─────┬─────────────┬─────────────┬─────────────┬─────────────┐
│ fruits ┆ cars ┆ literal_stri ┆ B ┆ sum_A_by_ca ┆ sum_A_by_fr ┆ rev_A_by_fr ┆ sort_A_by_B │
│ --- ┆ --- ┆ ng_fruits ┆ --- ┆ rs ┆ uits ┆ uits ┆ _by_fruits │
│ str ┆ str ┆ --- ┆ i64 ┆ --- ┆ --- ┆ --- ┆ --- │
│ ┆ ┆ str ┆ ┆ i64 ┆ i64 ┆ i64 ┆ i64 │
╞══════════╪══════════╪══════════════╪═════╪═════════════╪═════════════╪═════════════╪═════════════╡
│ "apple" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 7 ┆ 4 ┆ 4 │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "apple" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 7 ┆ 3 ┆ 3 │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "banana" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 8 ┆ 5 ┆ 5 │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "banana" ┆ "audi" ┆ "fruits" ┆ 11 ┆ 2 ┆ 8 ┆ 2 ┆ 2 │
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ "banana" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 8 ┆ 1 ┆ 1 │
└──────────┴──────────┴──────────────┴─────┴─────────────┴─────────────┴─────────────┴─────────────┘
Performance 🚀🚀
Polars is very fast, and in fact is one of the best performing solutions available. See the results in h2oai's db-benchmark.
Python setup
Install the latest polars version with:
$ pip3 install polars
Update existing polars installation to the lastest version with:
$ pip3 install -U polars
Releases happen quite often (weekly / every few days) at the moment, so updating polars regularily to get the latest bugfixes / features might not be a bad idea.
Rust setup
You can take latest release from crates.io
, or if you want to use the latest features / performance improvements
point to the master
branch of this repo.
polars = { git = "https://github.com/pola-rs/polars", rev = "<optional git tag>" }
Rust version
Required Rust version >=1.58
Documentation
Want to know about all the features Polars supports? Read the docs!
Python
- Installation guide:
$ pip3 install polars
- Python documentation
- User guide
Rust
Node
- Installation guide:
$ yarn install nodejs-polars
- Node documentation
- User guide
Contribution
Want to contribute? Read our contribution guideline.
[Python]: compile polars from source
If you want a bleeding edge release or maximal performance you should compile polars from source.
This can be done by going through the following steps in sequence:
- Install the latest Rust compiler
- Install maturin:
$ pip3 install maturin
- Choose any of:
- Fastest binary, very long compile times:
$ cd py-polars && maturin develop --rustc-extra-args="-C target-cpu=native" --release
- Fast binary, Shorter compile times:
$ cd py-polars && maturin develop --rustc-extra-args="-C codegen-units=16 -C lto=thin -C target-cpu=native" --release
- Fastest binary, very long compile times:
Note that the Rust crate implementing the Python bindings is called py-polars
to distinguish from the wrapped
Rust crate polars
itself. However, both the Python package and the Python module are named polars
, so you
can pip install polars
and import polars
.
Arrow2
Polars has transitioned to arrow2. Arrow2 is a faster and safer implementation of the Apache Arrow Columnar Format. Arrow2 also has a more granular code base, helping to reduce the compiler bloat.
Acknowledgements
Development of Polars is proudly powered by
Sponsors
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT
- Author: ritchie46 <ritchie46@gmail.com>
- Requires: Python >=3.7
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
Built Distributions
Uploaded
CPython 3.6+
manylinux: glibc 2.12+ x86-64
Uploaded
CPython 3.6+
macOS 11.0+ ARM64
Uploaded
CPython 3.6+
macOS 10.7+ x86-64
File details
Details for the file polars-0.13.1.tar.gz
.
File metadata
- Download URL: polars-0.13.1.tar.gz
- Upload date:
- Size: 725.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.10-beta.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ff91fed7da33a556185f51c8b112adf18e1b1a38af5cd7d4aa708a509a0063d |
|
MD5 | 2b4a7c6e4de02eb51d7c673992cce71f |
|
BLAKE2b-256 | ea44ac33a11d9442210539f3502364f3ac2f7d1a38c7e81e29f7b7545961769b |
File details
Details for the file polars-0.13.1-cp36-abi3-win_amd64.whl
.
File metadata
- Download URL: polars-0.13.1-cp36-abi3-win_amd64.whl
- Upload date:
- Size: 10.5 MB
- Tags: CPython 3.6+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88496850404693e5bbb1e5b98bc79e24b5aefa4103801949532a774581593a9c |
|
MD5 | 4535b8986881182358a66989d6f62aae |
|
BLAKE2b-256 | a058f2180162623d044b8c6ce662b90fe122605dc90469133833119f0249c421 |
File details
Details for the file polars-0.13.1-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: polars-0.13.1-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 10.2 MB
- Tags: CPython 3.6+, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.10-beta.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f91c48646886c4106feef194badd3e4926ca91e7cfbef43fa187ecec82f561cb |
|
MD5 | 63cc3b2fae915721c2b981d0fc6cfd8f |
|
BLAKE2b-256 | 60308c96b1ae90269b012811732da9c4389604297cd30cf2e87a001b3a7f476f |
File details
Details for the file polars-0.13.1-cp36-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: polars-0.13.1-cp36-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.6+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c20811289e0268245beb6b60f8834c1efc6ddb283871b9cab10cdf60a64759e6 |
|
MD5 | b2168665737dad022400b988cd871caf |
|
BLAKE2b-256 | f35d9be47bb4acf012b7949095a5ea33afca7dd27df1baf8417803888170ae0d |
File details
Details for the file polars-0.13.1-cp36-abi3-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: polars-0.13.1-cp36-abi3-macosx_10_7_x86_64.whl
- Upload date:
- Size: 9.9 MB
- Tags: CPython 3.6+, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45b0ccda68a6b1f86141b737f2b137a4a5058d2a7f7905eac47292f7730c95b2 |
|
MD5 | af986fd13f1bf643d3cb5c796d08161a |
|
BLAKE2b-256 | c55c1cc0dce528916c2b719d7ac1987b9750e9d81e5916563a269e05d08c77d1 |