How to run an .ipynb Jupyter Notebook from terminal?

nbconvert allows you to run notebooks with the –execute flag: jupyter nbconvert –execute <notebook> If you want to run a notebook and produce a new notebook, you can add –to notebook: jupyter nbconvert –execute –to notebook <notebook> Or if you want to replace the existing notebook with the new output: jupyter nbconvert –execute –to notebook … Read more

How to load/edit/run/save text files (.py) into an IPython notebook cell?

EDIT: Starting from IPython 3 (now Jupyter project), the notebook has a text editor that can be used as a more convenient alternative to load/edit/save text files. A text file can be loaded in a notebook cell with the magic command %load. If you execute a cell containing: %load filename.py the content of filename.py will … Read more

Autoreload of modules in IPython [duplicate]

For IPython version 3.1, 4.x, and 5.x %load_ext autoreload %autoreload 2 Then your module will be auto-reloaded by default. This is the doc: File: …my/python/path/lib/python2.7/site-packages/IPython/extensions/autoreload.py Docstring: “autoreload“ is an IPython extension that reloads modules automatically before executing the line of code typed. This makes for example the following workflow possible: .. sourcecode:: ipython In [1]: … Read more

Change IPython/Jupyter notebook working directory

jupyter notebook –help-all could be of help: –notebook-dir=<Unicode> (NotebookManager.notebook_dir) Default: u’/Users/me/ipynbs’ The directory to use for notebooks. For example: jupyter notebook –notebook-dir=/Users/yourname/folder1/folder2/ You can of course set it in your profiles if needed, you might need to escape backslash in Windows. Note that this will override whatever path you might have set in a jupyter_notebook_config.py … Read more

Simple way to measure cell execution time in ipython notebook

The only way I found to overcome this problem is by executing the last statement with print. Do not forget that cell magic starts with %% and line magic starts with %. %%time clf = tree.DecisionTreeRegressor().fit(X_train, y_train) res = clf.predict(X_test) print(res) Notice that any changes performed inside the cell are not taken into consideration in … Read more

Inserting image into IPython notebook markdown

Most of the answers given so far go in the wrong direction, suggesting to load additional libraries and use the code instead of markup. In Ipython/Jupyter Notebooks it is very simple. Make sure the cell is indeed in markup and to display a image use: ![alt text](imagename.png “Title”) Further advantage compared to the other methods … Read more

Jupyter Notebook not saving: ‘_xsrf’ argument missing from post

The easiest way I found is this: https://github.com/nteract/hydrogen/issues/922#issuecomment-405456346 Just open another (non-running, existing) notebook on the same kernel, and the issue is magically gone; you can again save the notebooks that were previously showing the _xsrf error. If you have already closed the Jupyter home page, you can find a link to it on the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)