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 󠀠󠀠 Twitter


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.5.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: rich_tools-0.5.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for rich_tools-0.5.1.tar.gz
Algorithm Hash digest
SHA256 ca30da26b8fe0a5af2e5c0b5fba1c3a0bdf40b52de62fdf99d0662db62e063b5
MD5 c65e7921e11feae12ba64cc619a1d6bf
BLAKE2b-256 fced5350411b9469495876dcce267fd35bbdc63bd502f1fd5fd914248cbb60d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rich_tools-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.10.12 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for rich_tools-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f13dbaab74681c07d965902b2432af85568219ed5bce42d670d113836bb87272
MD5 867f047d885cf82f0a711d3cd575ce3f
BLAKE2b-256 8d9adc79827022336b070704250ffff484c8b35d13ad47ffaae6dfb626c23288

See more details on using hashes here.

Supported by

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