Add your description here
Project description
catfact
Categorical wrangling for Python. Supports both Polars and Pandas. Enables categorical and ordinal scales in plotting tools like Plotnine.
catfact addresses some common challenges when working categorical data. Categorical data is useful when you want to display your data in a specific way, like alphabetical, most frequent first, or along a scale. It is a port of the popular R package forcats.
Installation
pip install catfact
Basic example
import polars as pl
import catfact as fct
from catfact.polars.data import starwars
(
starwars
.group_by("eye_color")
.agg(pl.len())
.sort("len", descending=True)
)
| eye_color | len |
|---|---|
| str | u32 |
| "brown" | 21 |
| "blue" | 19 |
| "yellow" | 11 |
| "black" | 10 |
| "orange" | 8 |
| … | … |
| "white" | 1 |
| "pink" | 1 |
| "blue-gray" | 1 |
| "green, yellow" | 1 |
| "dark" | 1 |
from plotnine import ggplot, aes, geom_bar, coord_flip
(
ggplot(starwars, aes("eye_color"))
+ geom_bar()
+ coord_flip()
)
(
starwars
.with_columns(
fct.infreq(pl.col("eye_color"))
)
>> ggplot(aes("eye_color"))
+ geom_bar()
+ coord_flip()
)
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 Distribution
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 catfact-0.1.0.tar.gz.
File metadata
- Download URL: catfact-0.1.0.tar.gz
- Upload date:
- Size: 348.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
463a1de1574183a8965a298989f55ea412469660344f03c5de1b3f1c21ee332e
|
|
| MD5 |
3a815239a448a8793084cf90e2ec017a
|
|
| BLAKE2b-256 |
f2985c04906bb1390aad45675bec1bc5ee5bde4e4703dc67ab58970b03c82382
|
Provenance
The following attestation bundles were made for catfact-0.1.0.tar.gz:
Publisher:
ci.yml on machow/catfact
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
catfact-0.1.0.tar.gz -
Subject digest:
463a1de1574183a8965a298989f55ea412469660344f03c5de1b3f1c21ee332e - Sigstore transparency entry: 248811302
- Sigstore integration time:
-
Permalink:
machow/catfact@0f27ccf8ba396fdb9a5a6b7108cee685d394e044 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/machow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0f27ccf8ba396fdb9a5a6b7108cee685d394e044 -
Trigger Event:
release
-
Statement type:
File details
Details for the file catfact-0.1.0-py3-none-any.whl.
File metadata
- Download URL: catfact-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab8c70a6939ed38e934f72b87e6c1557a7a91f0f55c409d779d7fd9a633517d4
|
|
| MD5 |
8501ab836ebdbed1ae4f2ecaa75875e4
|
|
| BLAKE2b-256 |
4ecf109d3bb60863bb3427383d12329c6ac28f3fe2787983d8561d1c9600e0ff
|
Provenance
The following attestation bundles were made for catfact-0.1.0-py3-none-any.whl:
Publisher:
ci.yml on machow/catfact
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
catfact-0.1.0-py3-none-any.whl -
Subject digest:
ab8c70a6939ed38e934f72b87e6c1557a7a91f0f55c409d779d7fd9a633517d4 - Sigstore transparency entry: 248811313
- Sigstore integration time:
-
Permalink:
machow/catfact@0f27ccf8ba396fdb9a5a6b7108cee685d394e044 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/machow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@0f27ccf8ba396fdb9a5a6b7108cee685d394e044 -
Trigger Event:
release
-
Statement type: