Skip to main content

R-style tibble() display for pandas DataFrames using Rich

Project description

pandas-tibble PyPI Version

Downloads

Display pandas DataFrames with R-style tibble formatting in the terminal.

What it does

  • Prints DataFrames with column type annotations (<chr>, <int>, <dbl>, <date>, <datetime>)
  • Shows dimensions at the top
  • Distinguishes between date and datetime types
  • Provides glimpse() for quick column overview

Installation

pip install pandas-tibble

For development:

git clone https://github.com/caspercrause/pandas-tibble.git
cd pandas-tibble
poetry install

Requirements

  • Python >= 3.10.0
  • pandas >= 2.0.0
  • rich >= 13.0.0

Usage

tibble()

Display DataFrame with type annotations:

import pandas as pd
from pandas_tibble import tibble
from datetime import date

df = pd.DataFrame({
    'start_date': [date(2024, 1, i) for i in range(1, 6)],
    'name': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve'],
    'value': [100, 200, 300, 400, 500]
})

tibble(df)

Output:

# A DataFrame: 5 × 3

start_date  name     value
<date>      <chr>    <int>
━━━━━━━━━━━━━━━━━━━━━━━━━━━
2024-01-01  Alice    100
2024-01-02  Bob      200
2024-01-03  Charlie  300
2024-01-04  Diana    400
2024-01-05  Eve      500

Options:

tibble(df, max_rows=20)         # Show more rows
tibble(df, show_index=True)     # Include index column

glimpse()

Quick column overview:

glimpse(df)

Output:

Rows: 5
Columns: 3

start_date  <date>  2024-01-01, 2024-01-02, 2024-01-03...
name        <chr>   Alice, Bob, Charlie...
value       <int>   100, 200, 300...

Type mapping

pandas dtype Display Format
object (string) <chr> as-is
int64 <int> as-is
float64 <dbl> 2 decimals
bool <lgl> True/False
datetime64[ns] <datetime> YYYY-MM-DD HH:MM:SS
object (date) <date> YYYY-MM-DD
category <fctr> as-is
timedelta64[ns] <timedelta> as-is

Missing values display as NA.

What it doesn't do

  • Does not create a Tibble class (works with standard pandas DataFrames)
  • Does not modify DataFrame behavior
  • Does not replicate R tibble's subsetting rules
  • Does not support tibble construction syntax

This is a display library, not a DataFrame replacement.

License

MIT

Author

Casper Crause

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

pandas_tibble-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

pandas_tibble-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pandas_tibble-0.1.1.tar.gz.

File metadata

  • Download URL: pandas_tibble-0.1.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.0 Darwin/24.6.0

File hashes

Hashes for pandas_tibble-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f699ae5c409236beccdba0bc52b67e4a7ee6d12b5ce9e4e27476764c240b04ab
MD5 e571ea53233af713db050419f43ea814
BLAKE2b-256 969a5c81b281eea394c67e0b365e427ffa3a3c2042dd939a89da78029adf9455

See more details on using hashes here.

File details

Details for the file pandas_tibble-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pandas_tibble-0.1.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.0 Darwin/24.6.0

File hashes

Hashes for pandas_tibble-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c41ba0ef60c9e03ffc674461209b7e1486cba31d5b2a3e5aefdd0e66480f4775
MD5 20a0f13070ce07a1994685e44c0d7d12
BLAKE2b-256 bf4eb92cdd2d95e7b17466572a1d0fe388c9cb66a15c294a4baf01ed97e5f795

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