Skip to main content

Enhanced DataFrame Display

Project description

FrameDisplay: Enhanced DataFrame Display

GitHub PyPI Python Versions License Codecov


DataFrame

FrameDisplay is a lightweight Python package for rendering Pandas DataFrames as interactive HTML tables within Jupyter Notebooks and JupyterLab. It improves the default DataFrame display by adding features such as resizable columns, client-side sorting, sticky headers and index for improved navigation, data type indicators in column headers, distinct styling for null values, and tooltips for viewing complete cell content.

I work extensively with Pandas in my personal projects and have always wanted something similar to Databricks' display function, but for Jupyter. The existing open-source alternatives were either too heavyweight, lacked the visual appeal or didn't check all the boxes I needed. So I built this package to bridge that gap. It's not perfect yet, but I like it more than the alternatives :)

Live demo: CodePen

Features

  • Resizable Columns: Drag column dividers to resize them.
  • Sortable Columns: Click on column headers to sort the data.
  • Sticky Header & Index: The header and index rows remain visible during vertical and horizontal scrolling.
  • Column Type Icons: Icons in headers indicate data types (numeric, string, etc.).
  • Null Value Styling: null values are visually distinct.
  • Tooltips: Hover over cell content to see the full value.
  • No Size Limit: Display DataFrames of any size (be mindful of browser performance with very large tables).

Roadmap

  • Virtual scrolling for improved performance with very large DataFrames.
  • Additional customization options (e.g., theming).

Installation

pip install framedisplay

Usage

To display a DataFrame, simply import framedisplay and use the frame_display function:

import pandas as pd
import numpy as np
import framedisplay as fd

df = pd.DataFrame({
    'Name': ['Alice', 'Bob', np.nan],
    'Age': [25, np.nan, 35],
    'Score': [95.5, 87.2, np.nan]
})

fd.frame_display(df)

You can also enable FrameDisplay globally for all DataFrames in Jupyter by calling fd.integrate_with_pandas():

import pandas as pd
import framedisplay as fd

# Enable FrameDisplay for all DataFrames
fd.integrate_with_pandas()

# This will now display using FrameDisplay
df

How it Works

FrameDisplay renders your Pandas DataFrame into an HTML table and injects custom CSS and JavaScript to enable interactive features directly in your Jupyter Notebook or browser.

Configuration (Optional)

You can customize the behavior and appearance by setting a global window.FrameDisplayConfig object in a Jupyter cell before displaying:

from IPython.display import display, HTML

display(HTML("""
<script>
window.FrameDisplayConfig = {
    minColumnWidth: 30,
    resizerWidth: 8,
    resizerHoverColor: 'rgba(0,0,0,0.1)',
    showHoverEffect: true,
    autoInit: true,
    allowReInit: true
};
</script>
"""))

Offline Mode

If you are working in an environment without internet access, you can inject the necessary JavaScript and CSS locally by calling initialize() at the start of your notebook. This bundles the required assets into the notebook itself.

import framedisplay as fd
fd.initialize()

# Now you can use fd.frame_display(df) without needing an internet connection

License

MIT

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

framedisplay-1.1.4.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

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

framedisplay-1.1.4-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file framedisplay-1.1.4.tar.gz.

File metadata

  • Download URL: framedisplay-1.1.4.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for framedisplay-1.1.4.tar.gz
Algorithm Hash digest
SHA256 90310d2a97331f30bcac702e67ad01733bb77b982e2de1e0e8926939f4dc98aa
MD5 2cf879cbfe5964f1a32d269b2e8fb8fb
BLAKE2b-256 372dd60d8fea0c2e4782086722a31d48d122b09efdc2fe161e65a960dc1c22ac

See more details on using hashes here.

File details

Details for the file framedisplay-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: framedisplay-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for framedisplay-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8b7788e38c8c146668be0cf5a5efd9c06fba341f16720225e31871f3fbf40d40
MD5 cedf62743768672243f26d86d05ae1c6
BLAKE2b-256 218b3c514bab73408cc097e9823c7f040191f703e5c3091c2634c34845095948

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