print multiple pandas tables in ipython notebook within one cell output

13,608 views
Skip to first unread message

Denis Akhiyarov

unread,
Oct 21, 2014, 10:45:10 AM10/21/14
to pyd...@googlegroups.com
How do I print multiple pandas tables in ipython notebook within one cell output?

I can print one dataframe as a table if it is the last statement, but if I put another print statement afterwords, then the previous dataframe printing is skipped.

how do I force to print multiple tables?


Miki Tebeka

unread,
Oct 22, 2014, 1:07:56 AM10/22/14
to pyd...@googlegroups.com
Greetings,

How do I print multiple pandas tables in ipython notebook within one cell output?
You can call "plt.figure()" between every plot - see http://nbviewer.ipython.org/gist/tebeka/e60b8c971557ce365929

Also some plot functions from pandas support "subplots" option, see http://pandas.pydata.org/pandas-docs/stable/visualization.html

HTH,
--
Miki 

Todd

unread,
Oct 22, 2014, 2:29:54 AM10/22/14
to pyd...@googlegroups.com

I think Denis's  question was about printing the numeric table itself, rather than a graph made from the table.

Stephan Hoyer

unread,
Oct 22, 2014, 2:57:41 AM10/22/14
to pyd...@googlegroups.com

Denis Akhiyarov

unread,
Oct 22, 2014, 3:12:33 PM10/22/14
to pyd...@googlegroups.com
display will still suppress all except last pandas dataframe table from the same cell.

Is there function such as pd.display()

Even this does not work:

from IPython.display import HTML
HTML(pd1.to_html())
HTML(pd2.to_html())

only pd2 is displa

Stephan Hoyer

unread,
Oct 22, 2014, 4:10:27 PM10/22/14
to pyd...@googlegroups.com
On Wed, Oct 22, 2014 at 12:12 PM, Denis Akhiyarov <denis.a...@gmail.com> wrote:
display will still suppress all except last pandas dataframe table from the same cell.

Hmm. That's not what I see. Try this in the notebook:

from IPython.display import display
import pandas as pd
display(pd.DataFrame({'x': [1]}))
display(pd.DataFrame({'y': [2]}))

If that still doesn't work, please report back with the output of pd.show_versions().


Denis Akhiyarov

unread,
Oct 22, 2014, 7:20:53 PM10/22/14
to pyd...@googlegroups.com
I got it, now it works:

from IPython.display import display
display(pd1)
display(pd2)
Reply all
Reply to author
Forward
0 new messages