tidypolars4sci


Nametidypolars4sci JSON
Version 0.0.1.21 PyPI version JSON
download
home_pageNone
SummaryTidyverse-like functions for python polars with extended functionalities for science.
upload_time2025-02-15 03:28:30
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseNone
keywords dataframe polars tidy data tidyverse
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![](https://github.com/DiogoFerrari/tidypolars4sci/blob/master/docs/tidypolars4sci.png?raw=True)

# TidyPolars $^{4sci}$

**tidypolars4sci** provides functions that match as closely as possible to R's [Tidyverse](https://www.tidyverse.org/) functions for manipulating data frames and conducting data analysis in Python using the blazingly fast [Polars](https://github.com/pola-rs/polars) as backend.

The name **tidypolars4sci** reflects the module's main features:

1. Matches the function names and functionalities of R's [Tidyverse](https://tidyverse.org/).
2. Leverages the performance and efficiency of [Polars](https://github.com/pola-rs/polars) under the hood.
3. Tailored for scientific research, extending the default functionalities of both Polars and Tidyverse.

## Details

**tidypolars4sci** is an **extended** API for [Polars](https://github.com/pola-rs/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](https://pola.rs/posts/benchmarks/)).

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](https://tidyverse.org/), 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

`<under construction>`


## Installation

You can install tidypolars4sci with `pip`:

```bash
$ pip3 install tidypolars4sci
```

Or through `conda`:
```bash
$ conda install -c conda-forge tidypolars4sci
```

## Basic usage

tidypolars4sci methods are designed to work like tidyverse functions:

```python
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        │
└─────┴─────┴─────┴──────────┴──────────┘

```

<!-- ## General syntax comparing with tidyverse -->


## 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.

```python
# 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`:

```python
# convert from pandas...
df = tp.from_pandas(df)
# or covert from polars
df = tp.from_polars(df)
```

## Similar projects

- [tidypolars](https://pypi.org/project/tidypolars/): tidypolars was the starting point of tidypolars4sci

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tidypolars4sci",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "Diogo Ferrari <diogoferrari@gmail.com>",
    "keywords": "dataframe, polars, tidy data, tidyverse",
    "author": null,
    "author_email": "Diogo Ferrari <diogoferrari@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/02/99/f0361644402e5fb23de15eb465a97f16211400691c542cafeec27cd1e0e8/tidypolars4sci-0.0.1.21.tar.gz",
    "platform": null,
    "description": "![](https://github.com/DiogoFerrari/tidypolars4sci/blob/master/docs/tidypolars4sci.png?raw=True)\n\n# TidyPolars $^{4sci}$\n\n**tidypolars4sci** provides functions that match as closely as possible to R's [Tidyverse](https://www.tidyverse.org/) functions for manipulating data frames and conducting data analysis in Python using the blazingly fast [Polars](https://github.com/pola-rs/polars) as backend.\n\nThe name **tidypolars4sci** reflects the module's main features:\n\n1. Matches the function names and functionalities of R's [Tidyverse](https://tidyverse.org/).\n2. Leverages the performance and efficiency of [Polars](https://github.com/pola-rs/polars) under the hood.\n3. Tailored for scientific research, extending the default functionalities of both Polars and Tidyverse.\n\n## Details\n\n**tidypolars4sci** is an **extended** API for [Polars](https://github.com/pola-rs/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](https://pola.rs/posts/benchmarks/)).\n\nThe primary distinction between **tidypolars4sci** and Polars lies in user interaction. The frontend functions are designed to closely resemble those available in R's [Tidyverse](https://tidyverse.org/), making it easier for users familiar with that ecosystem to transition to this library.\n\nAnother 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.\n\nNote: Due to the additional functionalities provided, **tidypolars4sci** may operate slightly slower than using Polars directly.\n\n\n## Documentation\n\n`<under construction>`\n\n\n## Installation\n\nYou can install tidypolars4sci with `pip`:\n\n```bash\n$ pip3 install tidypolars4sci\n```\n\nOr through `conda`:\n```bash\n$ conda install -c conda-forge tidypolars4sci\n```\n\n## Basic usage\n\ntidypolars4sci methods are designed to work like tidyverse functions:\n\n```python\nimport tidypolars4sci as tp\n\n# create tibble data frame\ndf = tp.tibble(x = range(3),\n               y = range(3, 6),\n               z = ['a', 'a', 'b'])\n\n(\n    df\n    .select('x', 'y', 'z')\n    .filter(tp.col('x') < 4, tp.col('y') > 1)\n    .arrange(tp.desc('z'), 'x')\n    .mutate(double_x = tp.col('x') * 2,\n            x_plus_y = tp.col('x') + tp.col('y')\n            )\n)\n\u250c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 x   \u2506 y   \u2506 z   \u2506 double_x \u2506 x_plus_y \u2502\n\u2502 --- \u2506 --- \u2506 --- \u2506 ---      \u2506 ---      \u2502\n\u2502 i64 \u2506 i64 \u2506 str \u2506 i64      \u2506 i64      \u2502\n\u255e\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561\n\u2502 2   \u2506 5   \u2506 b   \u2506 4        \u2506 7        \u2502\n\u251c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u2524\n\u2502 0   \u2506 3   \u2506 a   \u2506 0        \u2506 3        \u2502\n\u251c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u253c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u254c\u2524\n\u2502 1   \u2506 4   \u2506 a   \u2506 2        \u2506 5        \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\n```\n\n<!-- ## General syntax comparing with tidyverse -->\n\n\n## Converting to/from pandas data frames\n\nIf 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.\n\n```python\n# convert to pandas...\ndf = df.to_pandas()\n# ... or convert to polars\ndf = df.to_polars()\n```\n\nTo convert from a pandas or polars `DataFrame` to a tidypolars `tibble`:\n\n```python\n# convert from pandas...\ndf = tp.from_pandas(df)\n# or covert from polars\ndf = tp.from_polars(df)\n```\n\n## Similar projects\n\n- [tidypolars](https://pypi.org/project/tidypolars/): tidypolars was the starting point of tidypolars4sci\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Tidyverse-like functions for python polars with extended functionalities for science.",
    "version": "0.0.1.21",
    "project_urls": {
        "Changelog": "https://github.com/DiogoFerrari/tidypolars4sci/blob/master/CHANGELOG.md",
        "Documentation": "https://github.com/DiogoFerrari/tidypolars4sci",
        "Homepage": "https://github.com/DiogoFerrari/tidypolars4sci",
        "Issues": "https://github.com/DiogoFerrari/tidypolars4sci/issues/"
    },
    "split_keywords": [
        "dataframe",
        " polars",
        " tidy data",
        " tidyverse"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "07c279b3a27e16a206b045eb7e174b93a27078ea4e4715b7aee46a0128c8e73b",
                "md5": "c93717f4081e6cd30bec39f38bce32b1",
                "sha256": "18deadc4c7a3f2997894f63ae42c3be9e2f4987d21dea7a3ab9723a050543138"
            },
            "downloads": -1,
            "filename": "tidypolars4sci-0.0.1.21-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c93717f4081e6cd30bec39f38bce32b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 631968,
            "upload_time": "2025-02-15T03:28:26",
            "upload_time_iso_8601": "2025-02-15T03:28:26.883647Z",
            "url": "https://files.pythonhosted.org/packages/07/c2/79b3a27e16a206b045eb7e174b93a27078ea4e4715b7aee46a0128c8e73b/tidypolars4sci-0.0.1.21-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0299f0361644402e5fb23de15eb465a97f16211400691c542cafeec27cd1e0e8",
                "md5": "f0365a08afa3fbca2cdd0f517f6360cb",
                "sha256": "ec4f7d04910d139f7013ea97963eac3aa35cea879fee1d9bce8b27b5cab8e042"
            },
            "downloads": -1,
            "filename": "tidypolars4sci-0.0.1.21.tar.gz",
            "has_sig": false,
            "md5_digest": "f0365a08afa3fbca2cdd0f517f6360cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 697312,
            "upload_time": "2025-02-15T03:28:30",
            "upload_time_iso_8601": "2025-02-15T03:28:30.326253Z",
            "url": "https://files.pythonhosted.org/packages/02/99/f0361644402e5fb23de15eb465a97f16211400691c542cafeec27cd1e0e8/tidypolars4sci-0.0.1.21.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-15 03:28:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DiogoFerrari",
    "github_project": "tidypolars4sci",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tidypolars4sci"
}
        
Elapsed time: 0.86716s