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.1.tar.gz (5.6 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.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pandas_tibble-0.2.1.tar.gz
  • Upload date:
  • Size: 5.6 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.1.tar.gz
Algorithm Hash digest
SHA256 045ebbd8d4eb62922040d875c4eb979c12ff89a360ae141f4b16b80e192347b9
MD5 6aa92bd7109c171171f6aaec2a435a61
BLAKE2b-256 56b383f1c1a5949ad466205a4a7237b5d5c2d80a1917f0e5ebf1eefd7ed6b5bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pandas_tibble-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 211d5f2be897323e77ae0414ef34dc7a528f1f7a09bc0e476f89b52d2deca81a
MD5 33f2abdc01c98b57995971c0607ee880
BLAKE2b-256 66e45897070f6470880434eef2a3109ac627db95d137a33af2e9e25cc41db46f

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