Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

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

Project description


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


When converting Jupyter Notebooks to pdf using nbconvert, pandas DataFrames appear as either raw text or as a simple latex table as seen on the left side of the image below.


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, as seen on the right side of the image above.


pip install dataframe_image


There are three different ways to use dataframe_image:

  • Within a Jupyter Notebook
  • As a Python library
  • From the command line

To get access to all of the available options, use it as a library or from the command line. Using it within the notebook uses the default options and downloads a pdf.

Within a Jupyter Notebook

Upon installation, a new option will appear in your Jupyter Notebook under File -> Download as -> PDF - DataFrame as Image.


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

The conversion process is time consuming as screenshots of each DataFrame will be taken and then embedded into a pdf. A new blank tab will open during the processing. It will appear as nothing is happening. When processing is complete, the document will be downloaded.

When using this option, the notebook will NOT be executed. Make sure to execute the notebook first.

As a Python Library

Using dataframe_image as a Python library provides you with all of the available options, including downloading as a Markdown document.

>>> import dataframe_image as dfi
>>> dfi.convert('path/to/your_notebook.ipynb',

By default, the new file(s) will be saved in the same directory where the notebook resides.

Do not run this command within the same notebook that is being converted.

From the Command Line

The command line tool dataframe_image will be available upon installation with the same options as the convert function from above.

The command line tool is experimental as of now. Use dataframe_image as a library for a more stable version.

dataframe_image --to=pdf "my notebook with dataframes.ipynb"

Finding Google Chrome

You must have Google Chrome installed in order for dataframe_image to work. The path to Chrome will automatically be found. If Chrome is not in a standard location, set it with the chrome_path parameter.

Publish to Medium (upcoming)

You can publish your notebooks as Medium blog posts by installing the jupyter_to_medium package which first converts your notebook to markdown using dataframe_image.


This package also embeds any images added to markdown cells as attachments (done by dragging and dropping the image) as well as those referenced by HTML <img> tags.

It is also able to properly save the pdf/markdown and its images in a directory outside of where it is located.


You must have the following python libraries installed:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dataframe-image, version 0.0.7
Filename, size File type Python version Upload date Hashes
Filename, size dataframe_image-0.0.7-py3-none-any.whl (16.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dataframe_image-0.0.7.tar.gz (13.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page