[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pandas printing in jupyter

On 2018-01-11 09:59, Rustom Mody wrote:
> On Thursday, January 11, 2018 at 2:13:46 PM UTC+5:30, Paul  Moore wrote:
>> The HTML representation is supplied by the object's _repr_html_
>> method. See https://ipython.org/ipython-doc/3/config/integrating.html
>> for some details.
>>>>> import pandas as pd
>>>>> df = pd.DataFrame()
>>>>> df._repr_html_()
>> '<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type 
>> etc
> Thanks ? Useful direction
> So is there some ipython related restricted set of special (dunder-like) methods?

The ?moral equivalent of print()?* in IPython is display(), which is
documented here:

It checks a list of special methods, which are listed in those docs.

Note that these days display() is available by default in all IPython
(notebook or non-notebook) sessions; in the past it had to be imported.

On a different note somewhat related to your original question: If you
want more control over how a DataFrame is displayed, you can have it:

-- Thomas

* direct quote from