TidyPolars $^{4sci}$
tidypolars4sci provides functions that match as closely as possible to R's Tidyverse functions for manipulating data frames and conducting data analysis in Python using the blazingly fast Polars as backend.
The name tidypolars4sci reflects the module's main features:
- Matches the function names and functionalities of R's Tidyverse.
- Leverages the performance and efficiency of Polars under the hood.
- Tailored for scientific research, extending the default functionalities of both Polars and Tidyverse.
Details
tidypolars4sci is an extended API for Polars. One of the main advantages of using Polars as a data manipulation engine is its exceptional speed when compared to other alternatives (see here).
The primary distinction between tidypolars4sci and Polars lies in user interaction. The frontend functions are designed to closely resemble those available in R's Tidyverse, making it easier for users familiar with that ecosystem to transition to this library.
Another useful feature of tidypolars4sci is its extensive functionality aimed at facilitating data analysis and reporting for scientific research and academic publications. This includes the creation of LaTeX tables, which enhances the presentation of results.
Note: Due to the additional functionalities provided, tidypolars4sci may operate slightly slower than using Polars directly.
Documentation
Available here.
Installation
You can install tidypolars4sci with pip:
$ pip3 install tidypolars4sci
Or through conda:
$ conda install -c conda-forge tidypolars4sci
Basic usage
tidypolars4sci methods are designed to work like tidyverse functions:
import tidypolars4sci as tp
# create tibble data frame
df = tp.tibble(x = range(3),
y = range(3, 6),
z = ['a', 'a', 'b'])
(
df
.select('x', 'y', 'z')
.filter(tp.col('x') < 4, tp.col('y') > 1)
.arrange(tp.desc('z'), 'x')
.mutate(double_x = tp.col('x') * 2,
x_plus_y = tp.col('x') + tp.col('y')
)
)
┌─────┬─────┬─────┬──────────┬──────────┐
│ x ┆ y ┆ z ┆ double_x ┆ x_plus_y │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ str ┆ i64 ┆ i64 │
╞═════╪═════╪═════╪══════════╪══════════╡
│ 2 ┆ 5 ┆ b ┆ 4 ┆ 7 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
│ 0 ┆ 3 ┆ a ┆ 0 ┆ 3 │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┤
│ 1 ┆ 4 ┆ a ┆ 2 ┆ 5 │
└─────┴─────┴─────┴──────────┴──────────┘
Converting to/from pandas data frames
If you need to use a package that requires pandas or polars data frames, you can convert from a tidypolars4sci tibble to either of those DataFrame formats.
# convert to pandas...
df = df.to_pandas()
# ... or convert to polars
df = df.to_polars()
To convert from a pandas or polars DataFrame to a tidypolars tibble:
# convert from pandas...
df = tp.from_pandas(df)
# or covert from polars
df = tp.from_polars(df)
Similar projects
- tidypolars: tidypolars was the starting point of tidypolars4sci
Metadata
Release files for tidypolars4sci 0.0.1.23
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tidypolars4sci-0.0.1.23.tar.gz | 4.5 MB | Without provenance | Details for tidypolars4sci-0.0.1.23.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tidypolars4sci-0.0.1.23-py3-none-any.whl | Python 3 | none | any | Details for tidypolars4sci-0.0.1.23-py3-none-any.whl |
Total release size: 5.2 MB
Release files / tidypolars4sci-0.0.1.23.tar.gz
| Download URL | tidypolars4sci-0.0.1.23.tar.gz |
|---|---|
| Size | 4.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7921b800293f088d0dde83d432ddad0b2bb5f56889db995e8b535827c2d45a88
|
|
BLAKE2b-256 checksum How to use checksums |
0757b705ca53f318eab6504a1ca0fcfa603492fbd6e3a40275857aab47ae3b69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / tidypolars4sci-0.0.1.23-py3-none-any.whl
| Download URL | tidypolars4sci-0.0.1.23-py3-none-any.whl |
|---|---|
| Size | 714.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
713b496f362cd83ddc7b0f4edf3ad93989448d82e0883d4b874ec138909a2cfb
|
|
BLAKE2b-256 checksum How to use checksums |
d8de370593e1d352f2d65d8c5682fb48e75c039362f26b75097183279a14fac7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for tidypolars4sci 0.0.1.23
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.