Skip to main content

A python package with helpful tools when working with the rich python library.

Project description

🔧 Rich Tools

A python package with helpful functions for use alongside with the rich python library.

PyPI version Supported Python Versions Test


The current features are:

  • Convert a Pandas DataFrame into a rich Table ➜ df_to_table()

    By making this conversion, we can now pretty print a DataFrame in the terminal with rich. Bridging the gap between pandas and rich also provides a path for loading external data into a rich Table using Pandas functions such as .from_csv()!

  • Convert a rich Table into a Pandas DataFrame ➜ table_to_df()

    By bridging the gap between a rich Table and a DataFrame, we can now take additional actions on our data such as
    saving the data to a csv using the Pandas function .to_csv()!

  • Convert a rich Table into a list of dictionaries. ➜ table_to_dicts()

    Get your tables rows as a list of dictionaries with column names as key, and row contents as values.

  • Strip rich markup tags from a string. ➜ strip_markup_tags()

    Helper function to remove tags from text formatted with rich. "[bold]Bold[/bold]" becomes "Bold"

Installation

$ pip install rich-tools

Example

Additional examples can be found in the examples dir.

# Print csv data to the terminal as a pretty printed rich formatted table

import pandas as pd
from rich import print
from rich_tools import df_to_table

if __name__ == '__main__':
    df = pd.read_csv("sample_input.csv")
    table = df_to_table(df)
    print(table)

Credits

  • Like the rich package itself, its creator Will McGugan is awesome! Check out Textual "a TUI (Text User Interface) framework for Python inspired by modern web development". Thank you for the advice you've given on this project! 🙏
  • I am grateful for folks who give some of their time to this project in any form. Check out the list of contributors and learn more about contributing here.

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

rich_tools-0.6.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

rich_tools-0.6.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file rich_tools-0.6.0.tar.gz.

File metadata

  • Download URL: rich_tools-0.6.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Windows/11

File hashes

Hashes for rich_tools-0.6.0.tar.gz
Algorithm Hash digest
SHA256 039fd87b076bf2d4fcd30e3a9b4b561b67d3ca98a1ffdb49416cb74e566896fc
MD5 103e44c82962fa2615d8a5e016644e94
BLAKE2b-256 1a81e7b5dae7aa5bdf89a833845fdd12d5f1e0d622f308298f8a664f65bc0f5b

See more details on using hashes here.

File details

Details for the file rich_tools-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: rich_tools-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Windows/11

File hashes

Hashes for rich_tools-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a6971af5821c63f1d3fceb777b91f2e1215c3b9a086b00b0b78231306a40851
MD5 2d3149fe8cb79c8cc4fcee708ad1cc43
BLAKE2b-256 c5f40d88dd4ce83b789194900b0713a58573f8b66a016b99b1004a2e84f95fe3

See more details on using hashes here.

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