An Interesting and Lesser-Known Way To Create Plots Using Pandas

Whenever you print/display a DataFrame in Jupyter, it is rendered using HTML and CSS. This allows us to format the output just like any other web page.

One interesting way is to embed inline plots which appear as a column of a dataframe.

In the above snippet, we first create a plot as we usually do. Next, we return the <img> HTML tag with its source as the plot. Lastly, we render the dataframe as HTML.

Find the code for this tip here: Notebook.

Share this post on LinkedIn: Post Link.

Find the code for my tips here: GitHub.

I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.

Reply

or to participate.