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.2.0.tar.gz (5.5 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.2.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pandas_tibble-0.2.0.tar.gz
  • Upload date:
  • Size: 5.5 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.2.0.tar.gz
Algorithm Hash digest
SHA256 a7f5b0efbca499f66494eef1b8ad35835110be98a772cdc363ba19f9fff2b7f5
MD5 5842c504282c9b9af9afc8bc5c2099f1
BLAKE2b-256 d76564c90049d931796c3b6a1b3d3f68035df2c6850334e10fba582c5ec79808

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pandas_tibble-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbbdfd6015b0c3bfda91dd7cfcd0c9ffc812f3b24fcc16df9b441028d3874885
MD5 97f069c54c63b9cab3796ddda544b803
BLAKE2b-256 6ef9a6f025e339fe82ac4b11bc074cd5d4f1b545073995edbcdb4f7f967f3682

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