0

I am using ipython notebook with Python 2.x and I notice that usually there is a difference in how Python outputs if I use print command or do not use it. (Latter works only for last line in the cell)

For instance

df=pd.DataFrame({'A':[1,2,3,4,5,6],'B':list('ABCDEF')})
print df
df

Would give

Output with and without print

I like the second output which is nicely tabulated but it disappears if I use print

How do I get the output with print command with table around it as currently seen in output without print ?

Thomas K
  • 39,200
  • 7
  • 84
  • 86
PagMax
  • 8,088
  • 8
  • 25
  • 40
  • 1
    This is true on the console as well. It's the difference between the `str` and `repr` functions in Python. – Alyssa Haroldsen Mar 08 '16 at 00:08
  • Thanks @user3697163 for pointing to the previous query. I tried to search before posting but could not find it with keywords I was trying. I was sure this would have been discussed earlier. – PagMax Mar 08 '16 at 00:12

0 Answers0