Showing posts with label jupyter. Show all posts
Showing posts with label jupyter. Show all posts

Wednesday, July 22, 2020

Killer Jupyter Notebook Tips

A keeper

 

How to Clear Cell Output : 

ESC - R

will do it. ESC goes into command mode.

R then takes you into Raw mode, which clears the output.

And there you have it :)

Saturday, February 29, 2020

The Magic of Jupyter - via Cygwin!

And you wouldn't even know - such a breeze to install. And, when you launch, you can use the regular browser - like Chrome..

But, why are terminals unavailable?

Wednesday, August 14, 2019

Converting ipynb to python script

 Okay, this guy's stuff is old - too old :

https://medium.com/@researchplex/the-easiest-way-to-convert-jupyter-ipynb-to-python-py-912e39f16917

And fairly useless too, because he doesn't tell you you need to do

$ > python3 -m IPython nbconvert --to python name.ipynb

When you do that, python warns you and suggests using jupyter nbconvert (same arguments)

That actually works - and you also get the markdown as comments. If you'd rather not, then, there's :

https://stackoverflow.com/questions/37423380/ignore-markdown-cells-in-jupyter-nbconvert-with-to-script

Saturday, December 29, 2018

Spyder++

What *would* be nice is to incorporate some 20+ year old technology such as what NEdit already has - that is, let users record interaction with the GUI and create custom macros that they can then bind keyboard shortcuts to.

For example, based on my mood, I'd like to toggle between the light and dark theme. You listening Pierre Raybaut? Please …

Google "spyder keyboard shortcut toggle between light and dark theme" and see what you get..

Friday, December 28, 2018

Hans Fangohr++ aka A Better Spyder Tutorial

Why not anticipate users' problems - especially when you give them advanced tips?

He says, set IPython Console to do symbolic math (Tools > Preferences) and then you'll see cuter stuff.

He doesn't say :

Start a new console.
What happens if you run into ..

These commands were executed:
from __future__ import division
from sympy import *
x, y, z, t = symbols('x y z t')
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)

Warning: pylab (numpy and matplotlib) and symbolic math (sympy) are both
enabled at the same time. Some pylab functions are going to be overrided by
the sympy module (e.g. plot)


expr = (x + y) ** 3
Traceback (most recent call last):

  File "<ipython-input-1-530ade24fb9f>", line 1, in <module>
    expr = (x + y) ** 3

NameError: name 'x' is not defined

In short, what an ass!

Fortunately, we have some online angels :

https://github.com/spyder-ide/spyder/issues/3255
https://stackoverflow.com/questions/43915513/how-to-get-latex-style-output-from-sympy-in-spyder-ipython-console
https://github.com/nteract/hydrogen/issues/1119

I go to Start > Anaconda > Anaconda Prompt and then do

> conda install -c conda-forge miktex

Dat fix it? No!!

What did?

The commands that *IT* (see above) says *were* executed apparently weren't! So, you have to manually do :

x, y, z, t = symbols( 'x y z t') 
only to find that

NameError: name 'symbols' is not defined

And then,

from sympy import symbols

That gets

expr = (x + y)**3
To NOT complain.

Now, when you do expr, you get the Unicode formatted pretty thing with the 3 really looking like a superscript. Not what you want obviously :)

So, what does work :

from sympy import init_printing
init_printing()

Now, when you do

expr

You get