Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

I am using iPython notebook. When I do this:

df

I get a beautiful table with cells. However, if i do this:

df1

df2 

it doesn't print the first beautiful table. If I try this:

print df1

print df2

It prints out the table in a different format that spills columns over and makes the output very tall.

Is there a way to force it to print out the beautiful tables for both datasets?

1 Answer

0 votes
by (41.4k points)

Here, you need to use the HTML() or display() functions from IPython's display module:

from IPython.display import display, HTML

# Assuming that dataframes df1 and df2 are already defined:

print "Dataframe 1:"

display(df1)

print "Dataframe 2:"

display(HTML(df2.to_html()))

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...