Pandas printing in jupyter

Rustom Mody rustompmody at gmail.com
Thu Jan 11 07:30:08 EST 2018


On Thursday, January 11, 2018 at 2:49:27 PM UTC+5:30, Thomas Jollans wrote:
> 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:
> https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html#IPython.display.display
> 
> 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:
> https://pandas.pydata.org/pandas-docs/stable/style.html

Thanks for the general directions

Specifically and for starters, I want a numpy array — lets say 2D to start with —
to be displayed(displayable) as elegantly as sympy does to (its) matrices



More information about the Python-list mailing list