Reputation: 5173
Here's my code
df1 = pd.DataFrame(np.arange(6).reshape(3,2),
....: columns=['A','B'])
df2 = pd.DataFrame(np.arange(6).reshape(3,2),
....: columns=['C','D'])
print df1
print '--Something Here---'
df2
here, I would get both df1 and df2 to print but only df2 that created HTML look.
How can I force python to create df1 to print to html in output as well as df2
Upvotes: 3
Views: 2008
Reputation: 13965
I'm not sure I totally understand the point of this. Why for example would you jsut not display the output in two different cells. In general in order to force the HMTL display of data in the notebook (if for example the dataframe is too large) then you do the following
from IPython.core.display import HTML
HMTL(df.to_html())
Does this answer you quetion?
In cell 1 I would have
HMTL(df.to_html())
In cell 2 I would have
print 'something'
HTML(df2.to_html())
Upvotes: 2