Question: How can you print 2 DataFrame tables together from 1 iPython Notebook row, such that both tables are displayed in the pretty table format?
The following prints just the second one, and print df.head()
does not produce a pretty table.
df = pd.DataFrame(np.random.randn(6,4), index=pd.date_range('20150101', periods=6), columns=list('ABCD'))
df2 = pd.DataFrame(np.random.randn(6,4), index=pd.date_range('20150101', periods=6), columns=list('WXYZ'))
df.head()
df2.head()
The following does not produce the pretty table needed:
print df.head()
print df2.head()
In the IPython notebook, only the result of the last line of a cell is shown, unless it is explicitly printed or displayed.
Some options:
df.head()
in the next cellprint df
to explicitly print the dataframe -> but, this gives the text representation instead of html representationUse display(df)
to explicitly display the dataframe, this will give the same html representation as how a dataframe is shown by default. You need the following import for this:
from IPython.display import display
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With