Skip to main content

Scrollable pandas dataframes in the terminal.

Project description

termpandas

Scrollable Pandas and Polars DataFrames in the Terminal.

tprint_demo.gif

Installation

pip install termpandas

Basic Usage

import pandas as pd
from termpandas import tprint

df = pd.read_csv('titanic.csv')
tprint(df)
  • Key Bindings:
    • k or Up Arrow Key to scroll up
    • j or Down Arrow Key to scroll down
    • h or Left Arrow Key to scroll left
    • l or Right Arrow Key to scroll right
    • enter to select a row
    • q to quit

Parameters

  • num_rows: Number of rows to display at a time. Default is 10.
tprint(df, num_rows=5)
  • highlight: Highlights the selected row. Default is True.
tprint(df, highlight=True)
  • highlight_color: Color of the selected row. Default is Gray.
tprint(df, highlight=True)
  • masks: Dictionary of masks to highlight rows. Default is {}. The keys are the colors and the values are the masks.
mask_1 = df['Survived'] == 1
mask_2 = df['Sex'] == 'male'
tprint(df.head(20), masks={'Red': mask_1,'Blue': mask_2})
  • return_row: Returns the selected row. Default is False. Press enter to select a row.
result = tprint(df.head(20), return_row=True)
try:
    tprint(result)
except:
    print("Quit termpandas: No row selected")

Available Colors

  • Red
  • Blue
  • Magenta
  • Gray

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

termpandas-0.2.1.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

termpandas-0.2.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

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