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.0.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.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pandas_tibble-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 209a6610b4aab82b70b8c9e1032f7a145e53ae8faf0e2898a7ee6dfceaac3366
MD5 b602d1c2e47333e363ffb829a57179e8
BLAKE2b-256 8f43af9536e0b0c7d0fbdfbe697164dd66000d934988a9d64618878e6a6403a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pandas_tibble-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41e0494b7fb8b3420a3d894f9c99c104704b9f19b2816c80d7dbeb67532926ba
MD5 26ce7f90d251706d58d60bf4a614e759
BLAKE2b-256 4a5def01e0df78b2e1c77cfa4dfa8b4279a481523c6cdfada871afd5f95ffc73

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