Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pavelcherepan/seaborn_polars
Wrapper allowing to use Polars DataFrames and LazyFrames for plotting with seaborn
https://github.com/pavelcherepan/seaborn_polars
Last synced: 2 months ago
JSON representation
Wrapper allowing to use Polars DataFrames and LazyFrames for plotting with seaborn
- Host: GitHub
- URL: https://github.com/pavelcherepan/seaborn_polars
- Owner: pavelcherepan
- License: apache-2.0
- Created: 2023-05-16T01:59:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-21T00:06:52.000Z (12 months ago)
- Last Synced: 2024-08-05T14:15:55.109Z (6 months ago)
- Language: Python
- Size: 15.6 KB
- Stars: 25
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-polars - Python package seaborn_polars - Python package to plot Polars DataFrames and LazyFrames with [seaborn](https://seaborn.pydata.org/) by [@pavelcherepan](https://github.com/pavelcherepan). (Libraries/Packages/Scripts / Python)
README
# seaborn_polars
Wrapper allowing to use Polars DataFrames and LazyFrames for plotting with seaborn# Requirements
Python 3.8+Seaborn, Polars, Pandas, Numpy, Pyarrow
# Installation
Use regular pip install:
```
pip install seaborn_polars pandas numpy polars seaborn pyarrow
```Install from the main branch on GitHub:
```
pip install pip install "git+https://github.com/pavelcherepan/seaborn_polars#egg=seaborn_polars"
```You may need to run `pip install --upgrade pip` first.
Alternatively, clone this repository and run `pip install .` from the project root directory.
# Usage
The package is a wrapper around seaborn plotting functions allowing to use Polars DataFrames and LazyFrames with the same syntax as when using Pandas DataFrames.
```
import polars as pl
import seaborn_polars as snldf = pl.scan_csv('data.csv')
snl.scatterplot(df, x='rating', y='responses', hue='gender')
```
The package uses a deepcopy of original data. That way the original dataframe remains unaffected. For example, in the code snippet above, if we check the type of `df` after plotting we'll see that it is still a Polars LazyFrame.All the plotting functions and parameters are identical to seaborn. When using data parameter, it has to be positional-only, the rest of parameters are keyword arguments.