Skip to main content

Embed pandas DataFrames as images in pdf and markdown files when converting from Jupyter Notebooks

Project description

dataframe_image

A package to embed pandas DataFrames as images when convert Jupyter Notebooks to pdf or markdown documents.

Motivation

When converting Jupyter Notebooks to pdf using nbconvert, pandas DataFrames appear as either raw text or as a simple latex table. Below, we have a pdf showing both the plain text and latex DataFrame representation.

png

This package was created to embed DataFrames into pdf and markdown documents as images so that they appear exactly as they do in a Jupyter Notebook. Here, the same DataFrame as above is shown in a pdf converted using dataframe_image.

png

Installation

pip install dataframe_image

Usage

In a separate Python script, import the dataframe_image package and pass the file name of your notebook to the convert function.

>>> import dataframe_image as dfi
>>> dfi.convert('path/to/your_notebook.ipynb',
                to='pdf',
                max_rows=30,
                max_cols=10,
                ss_width=1000,
                ss_height=900,
                resize=1,
                chrome_path=None,
                limit=None
                )

The new file(s) will be saved in the same directory where the notebook resides. dataframe_image will automatically find the location of chrome on Windows, macOS, and Linux. Set the to parameter to 'md' to convert to markdown.

Dependencies

You must have the following python libraries installed

You must also have Google Chrome installed.

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

dataframe_image-0.0.5.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

dataframe_image-0.0.5-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file dataframe_image-0.0.5.tar.gz.

File metadata

  • Download URL: dataframe_image-0.0.5.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200325 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for dataframe_image-0.0.5.tar.gz
Algorithm Hash digest
SHA256 7dc4f61d12ad603217623e69e5b84fc5d647dbb8a84ec4f57f3a20e9a73644bb
MD5 8887dc3450a405265ec7a5ea1122af18
BLAKE2b-256 75735df06302c7b3f22cd18950a80dee1844fdf9e0d175fb70098044586c23c9

See more details on using hashes here.

File details

Details for the file dataframe_image-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: dataframe_image-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200325 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for dataframe_image-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 625cafd80e2ddbc807a80a3434bb043701a0c734601a239677475b8649cfeb5e
MD5 15f9ea6828410b1b961446cd426a348e
BLAKE2b-256 b41a609125de93376586924b53fab38414e526e83c6aba547ac454cdec75dbb2

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