Skip to main content

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)
)
shape: (15, 2)
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

catfact-0.1.0.tar.gz (348.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

catfact-0.1.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

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

Hashes for catfact-0.1.0.tar.gz
Algorithm Hash digest
SHA256 463a1de1574183a8965a298989f55ea412469660344f03c5de1b3f1c21ee332e
MD5 3a815239a448a8793084cf90e2ec017a
BLAKE2b-256 f2985c04906bb1390aad45675bec1bc5ee5bde4e4703dc67ab58970b03c82382

See more details on using hashes here.

Provenance

The following attestation bundles were made for catfact-0.1.0.tar.gz:

Publisher: ci.yml on machow/catfact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for catfact-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab8c70a6939ed38e934f72b87e6c1557a7a91f0f55c409d779d7fd9a633517d4
MD5 8501ab836ebdbed1ae4f2ecaa75875e4
BLAKE2b-256 4ecf109d3bb60863bb3427383d12329c6ac28f3fe2787983d8561d1c9600e0ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for catfact-0.1.0-py3-none-any.whl:

Publisher: ci.yml on machow/catfact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page