How do use %%capture and Rich Outputs to generate an image of cell contents?

34 views
Skip to first unread message

Jon Seymour

unread,
Jul 23, 2021, 5:15:14 AM7/23/21
to Project Jupyter
G'day,

I am want to display the contents of a pandas DataFrame as a table within a notebook cell and then use a capture to capture the Rich Output of the cell and then ideal save this as a PNG file. I understand to do the capture (with %%capture), but I haven't been able to see way to use the capture to generate a PNG image.

Is there.straight forward way to achieve this with the Jupyter framework? 

jon.

Matthias Bussonnier

unread,
Aug 5, 2021, 12:55:19 PM8/5/21
to jup...@googlegroups.com
It depends, if the object you capture from does not have a PNG repr, no there is no way to do that. 

I don't think pandas does have a way to display dataframe a PNG, so their won't be a way to get PNG out of %%capture.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/0526b882-39df-4b78-9fc8-5cc426ac9a2cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages