dataframe2image
Convert pandas DataFrame to beautiful table images.
Features
- Convert pandas DataFrame to high-quality table images
- Beautiful, customizable styling with CSS
- Support for various image formats (PNG, JPEG, WebP)
- Responsive table design
- Easy to use API
Installation
pip install dataframe2image
After installation, you need to install Playwright browsers:
playwright install chromium
Quick Start
import pandas as pd
from dataframe2image import df_to_image
# Create a sample DataFrame
df = pd.DataFrame({
'Name': ['Alice', 'Bob', 'Charlie', 'Diana'],
'Age': [25, 30, 35, 28],
'City': ['New York', 'London', 'Tokyo', 'Paris'],
'Salary': [50000, 60000, 70000, 55000]
})
# Convert to image
df_to_image(df, output_path='table.png')
Advanced Usage
from dataframe2image import df_to_image, TableStyle
# Custom styling
style = TableStyle(
theme='dark',
font_family='Arial',
font_size=14,
border_color='#333',
header_bg_color='#4CAF50',
row_bg_colors=['#f9f9f9', '#ffffff']
)
df_to_image(
df,
output_path='styled_table.png',
style=style,
width=800,
height=600
)
API Reference
df_to_image(df, output_path, style=None, width=None, height=None, format='png')
Convert a pandas DataFrame to an image.
Parameters:
df(pandas.DataFrame): The DataFrame to convertoutput_path(str): Path where the image will be savedstyle(TableStyle, optional): Custom styling optionswidth(int, optional): Image width in pixelsheight(int, optional): Image height in pixels (auto if not specified)format(str): Image format ('png', 'jpeg', 'webp')
TableStyle
Customization options for table appearance.
Parameters:
theme(str): Theme name ('light', 'dark', 'minimal')font_family(str): Font family namefont_size(int): Font size in pixelsborder_color(str): Border color (CSS color)header_bg_color(str): Header background colorrow_bg_colors(list): Alternating row background colors
License
MIT License
Release files for dataframe2image 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dataframe2image-0.2.0.tar.gz | 4.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dataframe2image-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 MB
Release files / dataframe2image-0.2.0.tar.gz
| Download URL | dataframe2image-0.2.0.tar.gz |
|---|---|
| Size | 4.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
335c3757c53f8665e223714694e0ec7363d4128ea7f0c5e40312d8c8a7228411
|
|
BLAKE2b-256 checksum How to use checksums |
509f4dbe5ce02c3590c31c9b77983552f35771563ff1886716072fd9d4a49ebe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.15
|
Release files / dataframe2image-0.2.0-py3-none-any.whl
| Download URL | dataframe2image-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc4a77d0b0d284865fb04c9db926422356eb7ab2f9cc7d7fae9dedc7067ccef7
|
|
BLAKE2b-256 checksum How to use checksums |
454d18d1356e2b30dcfcd35f764de55ffec2f5860337b0b77d67976140122477
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.15
|