Matplotlib and Ipython-notebook: Displaying exactly the figure that will be saved

As noted by @andrew, the ipython magics are enforcing bbox_inches=”tight” by default. This can be overridden using other magics as explained in the ipython documentation: %matplotlib inline %config InlineBackend.print_figure_kwargs = {‘bbox_inches’:None} produces an inline image identical to that produced by savefig.

Pandas: Setting no. of max rows

Set display.max_rows: pd.set_option(‘display.max_rows’, 500) For older versions of pandas (<=0.11.0) you need to change both display.height and display.max_rows. pd.set_option(‘display.height’, 500) pd.set_option(‘display.max_rows’, 500) See also pd.describe_option(‘display’). You can set an option only temporarily for this one time like this: from IPython.display import display with pd.option_context(‘display.max_rows’, 100, ‘display.max_columns’, 10): display(df) #need display to show the dataframe when … Read more

How to hide code from cells in ipython notebook visualized with nbviewer?

from IPython.display import HTML HTML(”'<script> code_show=true; function code_toggle() { if (code_show){ $(‘div.input’).hide(); } else { $(‘div.input’).show(); } code_show = !code_show } $( document ).ready(code_toggle); </script> <form action=”javascript:code_toggle()”><input type=”submit” value=”Click here to toggle on/off the raw code.”></form>”’)

Show DataFrame as table in iPython Notebook

You’ll need to use the HTML() or display() functions from IPython’s display module: from IPython.display import display, HTML # Assuming that dataframes df1 and df2 are already defined: print “Dataframe 1:” display(df1) print “Dataframe 2:” display(HTML(df2.to_html())) Note that if you just print df1.to_html() you’ll get the raw, unrendered HTML. You can also import from IPython.core.display … Read more

IPython Notebook locale error [duplicate]

I summarize here the solution to be found on: http://blog.lobraun.de/2009/04/11/mercurial-on-mac-os-x-valueerror-unknown-locale-utf-8/ I added these lines to my .bash_profile: export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 I reloaded the profile: source ~/.bash_profile I then ran ipython again: ipython notebook Changing locales The above will work for the English language in a US locale. One may want different settings. At the … Read more