Delete cell ipython 2.0

In the new IPython cells could have two states: when it has a green selection rectangle around it you can edit what’s inside; when it has a grey rectangle around it you edit the cell itself (copy/paste/delete). Enter/Return makes it go green, Esc makes it go grey. When it is gray, ‘dd’ will delete it.

Automatically play sound in IPython notebook

TL;DR At the top of your notebook from IPython.display import Audio sound_file=”./sound/beep.wav” sound_file should point to a file on your computer, or accessible from the internet. Then later, at the end of the long-running cell <code that takes a long time> Audio(sound_file, autoplay=True) This method uses the Audio tag built into Newer versions of iPython/Jupyter. … Read more

Changing the default port for iPython notebook server / Jupyter

jupyter notebook –ip=0.0.0.0 –port=80 or ipython notebook –ip=0.0.0.0 –port=80 is what i did to run ipython in my vagrant box. (Opened up the ports on the vagrant box to access it on my host mac) usage: ipython [-h] [–certfile NOTEBOOKAPP.CERTFILE] [–ip NOTEBOOKAPP.IP] [–pylab [NOTEBOOKAPP.PYLAB]] [–log-level NOTEBOOKAPP.LOG_LEVEL] [–port-retries NOTEBOOKAPP.PORT_RETRIES] [–notebook-dir NOTEBOOKAPP.NOTEBOOK_DIR] [–config NOTEBOOKAPP.CONFIG_FILE] [–keyfile NOTEBOOKAPP.KEYFILE] [–port … Read more

How to run an IPython magic from a script (or timing a Python script)

It depends a bit on which version of IPython you have. If you have 1.x: from IPython import get_ipython ipython = get_ipython() If you have an older version: import IPython.core.ipapi ipython = IPython.core.ipapi.get() or import IPython.ipapi ipython = IPython.ipapi.get() Once that’s done, run a magic command like this: ipython.magic(“timeit abs(-42)”) Note that the script must … Read more

Getting wider output in PyCharm’s built-in console

For me, just setting ‘display.width’ wasn’t enough in pycharm, it kept displaying in truncated form. However, adding the option pd.set_option(“display.max_columns”, 10) together with display width worked and I was able to see the whole dataframe printed in the “run” output. In summary: import pandas as pd pd.set_option(‘display.width’, 400) pd.set_option(‘display.max_columns’, 10)