Hard-to-find tips on otherwise easy-to-do tasks involving everyday technology, with some advanced insight on history and culture thrown in. Brought to you by a master dabbler. T-S T-S's mission is to boost your competitiveness with every visit. This blog is committed to the elimination of the rat from the tree of evolution and the crust of the earth.
Wednesday, July 22, 2020
Killer Jupyter Notebook Tips
Saturday, February 29, 2020
The Magic of Jupyter - via Cygwin!
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 :
Saturday, December 29, 2018
Spyder++
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
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