Polars plugin for generating random distributions
Project description
polars-random
Polars plugin for generating random distributions.
Description
polars-random is a Rust plugin for the Polars DataFrame library that provides functionality to generate random numbers through a new dataframe namespace called "random". It supports generating random numbers from various distributions such as uniform, normal, and binomial.
You can set seeds, and pass the parameters as polars expressions or column names (as strings).
Installation
To use polars-random, install it using your favourite tool:
uv add polars-random
poetry add polars-random
pip install polars-random
Usage
Here are some examples of how to use the polars-random plugin:
Uniform Distribution
import polars as pl
import polars_random
df: pl.DataFrame = ...
random_series = (
df
.random.rand(low=1_000., high=2_000., name="rand")
.random.rand(seed=42, name="rand_seed")
.random.rand(
low=pl.col("custom_low"),
high=pl.col("custom_high"),
name="rand_expr",
)
.random.rand(
mean="custom_low",
std="custom_high",
name="rand_str",
)
)
Normal Distribution
import polars as pl
import polars_random
df: pl.DataFrame = ...
random_series = (
df
.random.normal(mean=3., std=2., name="normal")
.random.normal(seed=42, name="normal_seed")
.random.normal(
mean=pl.col("custom_mean"),
std=pl.col("custom_std"),
name="normal_expr",
)
.random.normal(
mean="custom_mean",
std="custom_std",
name="normal_str",
)
)
Binomial Distribution
import polars as pl
import polars_random
df: pl.DataFrame = ...
random_series = (
df
# Mandatory parameters n and p
.random.binomial(n=100, p=.5, seed=42, name="binomial")
.random.binomial(
n=pl.col("custom_n"),
p=pl.col("custom_p"),
name="binomial_expr",
)
.random.binomial(
n="n",
p="p",
name="binomial_str",
)
)
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polars_random-0.3.0.tar.gz.
File metadata
- Download URL: polars_random-0.3.0.tar.gz
- Upload date:
- Size: 80.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bac431557f0cdd26b0b096923e1f9ad2c42ed80285bfd2973150333c145268ad
|
|
| MD5 |
89fcee777e4e4c2704e2318b7bf48286
|
|
| BLAKE2b-256 |
bfc6379c3366117b511de704fc216bb7258667c1a79668cf2ce89a06c4ad3531
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ddfac121dd6d8f51c89f9368a2b3edc992aa542715f641e21291c3698c94a03
|
|
| MD5 |
be9165ee2565c286a921fab0eade6cdb
|
|
| BLAKE2b-256 |
a3e1431bb9e42471e36e59dad79c50c3c29bbe4b0006fef50af1ff8dd0bf04a6
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-win32.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-win32.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.8+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8149e1c0f072ef6d5fee43eb40ea562c9164fc169f534036065c51aad5790e22
|
|
| MD5 |
71bebfdf75decea7bb7ccf719531575a
|
|
| BLAKE2b-256 |
c123ad3414c8b9d9692484077018885c166247124a7a6cc5158ceba978c66d2f
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.4 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67c8f9fdd0de271dece152a51a43b5b394524f05fa4d4f5f891b17fb1e0455ab
|
|
| MD5 |
b5c46e81c60917b8854c93433deeacf4
|
|
| BLAKE2b-256 |
40459094416c16a907b6ce0cc2e04fa01384d51bd1567e8b5e2bf93230445e48
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42c971f4a3e59971b27f75a33151e2a0dda8f877040584dc1a4aa669d2d83873
|
|
| MD5 |
5c8eb2f6d113f4a5a417a4289f51ba01
|
|
| BLAKE2b-256 |
c49ecba6b101f940ad0cbdeb057a625d29285a30577fc4da91f80175e73b74ce
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 4.7 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
518d78b9973b3494b58d2afd583221d9e373fc1ea453e2669a244f55f5383095
|
|
| MD5 |
c6ad69b24581ecb8cfd28d7bb23bf4b5
|
|
| BLAKE2b-256 |
90a6ca27ab3c7765e5ecc2a19c564d557233dded11fe4bec3f7166446f7f6d7d
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ba406b455fd90ff26cfe11c367cefdb101a4e7fc00674500837f8ae01ee9bf2
|
|
| MD5 |
9d88e175a1352527b7ebc8237863a03a
|
|
| BLAKE2b-256 |
342ed1fff5ef6ac8968e836316ef643ebc5f3cf07f71cbb472be1594fd3738e2
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
709eaec6482e3e5f4f93bcf865489adcec9d9ef7bc6713bdc572734eadd8fe0a
|
|
| MD5 |
38ded35fe142331c6132bce68d141881
|
|
| BLAKE2b-256 |
89f20b6f89321fcc70745350fb572ba444a9b4009b74a5d2e51e7d2756758552
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2c6db6e55099e4928ec18829d6be1722ac311a662dcd77356b21706bd2570ed
|
|
| MD5 |
d0a1db084258b1e701120f3416f4528e
|
|
| BLAKE2b-256 |
5d150fae8a75d7faafd0b642fb13061289cf8798f10f3c30785dfa7a331136e0
|
File details
Details for the file polars_random-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: polars_random-0.3.0-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.9 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6676c1518fde8afd025a67b97fec8c8a9d984e704fe2ae30c461e2989837a35d
|
|
| MD5 |
0494c665b4112e9139a3fa6dff0aefe9
|
|
| BLAKE2b-256 |
2a4d1f8748692ca1e8dab2db6e228ca9bdb16346f3f3d6b373a715feaec5dc2e
|