Skip to main content

termpandas

Scrollable Pandas and Polars DataFrames in the Terminal.

tprint_demo.gif

Installation

pip install termpandas

Note: This library is not compatible with Windows at the moment.

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_color='Gray')
  • 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")

Polars Support

  • Note: Masks are not currently supported for Polars DataFrames. Convert to pandas DataFrames to utilize masks functionality.

  • Returning Selected Row is supported and works just like with Pandas DataFrames.

import polars as pl
from termpandas import tprint

# DataFrame needs to be collected
df = pl.scan_csv('titanic.csv').collect()
tprint(df)

Available Colors

  • Red
  • Blue
  • Magenta
  • Gray

Metadata

Release files for termpandas 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for termpandas 0.2.3
File Size Uploaded
termpandas-0.2.3.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for termpandas 0.2.3
File Interpreter ABI Platform
termpandas-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / termpandas-0.2.3.tar.gz

Download URL termpandas-0.2.3.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e5eeb9ebf72d61742112667f40d6bac5eb54b8956db86eed37a62167ccccaf80
BLAKE2b-256 checksum
How to use checksums
5d6cf1e7e95ff03208faff4d6ad0ba4131a7c4b03a6bdc1bd18af183db876574
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / termpandas-0.2.3-py3-none-any.whl

Download URL termpandas-0.2.3-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba6959852f1713fab75405cee33d14d644815fd0ae6b9bfc57ad0f83850400f6
BLAKE2b-256 checksum
How to use checksums
de1a878c2f673a9c593631a00a2538988c9bb70afda7ce5cc44c1540762fdb76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page