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 {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n </tr>\n </thead>\n <tbody>\n </tbody>\n</table>\n</div>' >>> help(df._repr_html_) Help on method _repr_html_ in module pandas.core.frame: _repr_html_() method of pandas.core.frame.DataFrame instance Return a html representation for a particular DataFrame. Mainly for IPython notebook. >>> Paul On 11 January 2018 at 04:23, Rustom Mody <rustompm...@gmail.com> wrote: > If I make a data-frame in pandas in jupyter notebook it prints very nicely > ie it looks quite like a spreadsheet > > How does it do it? > Who does it? > > The data-frame does not seem to have str/repr methods… > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list