Reputation: 2521
This is a pretty bizarre bug:
The following code:
a = 'string1'
b = 'string2'
test_dict = {'col1':{a:type(a), b:type(b)},'col2':{a:type(a), b:type(b)}}
pd.DataFrame(test_dict)
In a normal ipython console yields the following as expected:
col1 col2
string1 <type 'str'> <type 'str'>
string2 <type 'str'> <type 'str'>
However in the ipython notebook, the cells where the type should be displayed is empty:
Upvotes: 1
Views: 502
Reputation: 2979
A workaround is to print the dataframe, which makes it play better with the ipython notebook:
In [144]: print pd.DataFrame(test_dict)
col1 col2
string1 <type 'str'> <type 'str'>
string2 <type 'str'> <type 'str'>
I find the lines in the HTML tables distracting, so this workaround is my default.
Upvotes: 3
Reputation: 17713
I suspect that if you do a View->Source in your browser you will see the expected <type ...>. What's happening is that the browser thought this was an HTML tag, didn't recognize it, and simply threw it out.
Note: if I had not typed &lt;type ...>
in this answer, the same thing would have happened to my answer.
Upvotes: 4