edit:pandas multiline value in ipython notebook
Question: If I put something with newlines in cell into pandas dataframe, for example:

    
    
    pd.DataFrame(data=[["""aa\n<br>
    bb"""], ['bb']], columns=["col"])
    

I get something where all "newlines" are escaped. (html source looks like:
<td> aa\n&lt;br&gt;\n\nbb</td>)

Is there way to get table with formatted multiline output in cell?

**edit** : inspired by firelynx I could use now this:

**edit2** : html escaping added

**edit3** : nowrap attribute for td and th tags

    
    
    df=pd.Dataframe(...)  # see definition above
    from IPython.display import HTML
    import cgi
    
    def escape(a):
        return cgi.escape(a).replace('\n','<br>')
    
    htm='<table>'+\
        '<thead><tr><th></th>'+\
        ''.join(['<th nowrap>'+escape(c)+\
        '</th>' for c in df])+'</tr></thead>'+ \
        '<tbody>'+''.join(['<tr>'+'<th>'+str(r[0])+\
        '</th>'+''.join(['<td nowrap>'+escape(c)+\
        '</td>' for c in r[1]])+'</tr>' for r in enumerate(df.values)])+\
        '</tbody></table>'
    #print(htm)
    HTML(htm)
    


Answer: The ipython notebook formats data for you if you just return values from a
cell in the way you do.

To see the actual value, you have to explicitly print it, look here:

    
    
    df = pd.DataFrame(data=[["""aa\n<br>
    bb"""], ['bb']], columns=["col"])
    print df.ix[0].col
    
    aa
    <br>
    bb
    

So nothing is actually wrong, it's just the ipython representation that fails
to show the truth.

There are display options to be changed, but nothing that revokes this default
behaviour. The display options are set by, for example:

    
    
    pd.options.display.expand_frame_repr = False
    

[Display option reference](http://pandas.pydata.org/pandas-
docs/stable/options.html)

