Jupyter Notebook: Difference between revisions
Line 78: | Line 78: | ||
<pre> | <pre> | ||
%cd gdrive/path/to/file | %cd gdrive/path/to/file | ||
</pre> | |||
and see the change with | |||
<pre> | |||
!pwd | !pwd | ||
</pre> | </pre> |
Latest revision as of 16:51, 13 December 2021
Start
- install ( mac)
pip install jupyterlab
- run
jupyter notebook --no-browser --ip 0.0.0.0 --port 5000
jupyter notebook --no-browser --ip 0.0.0.0 --port 5000 --log-level=DEBUG
inline image:
possibly this:
%matplotlib inline
possibly this:
from IPython.display import Image
To Read
https://voila.readthedocs.io/en/stable/index.html
Tables in put put
ref: https://stackoverflow.com/questions/35160256/how-do-i-output-lists-as-a-table-in-jupyter-notebook
also: https://pypi.python.org/pypi/tabulate
from IPython.display import HTML, display import tabulate table = [["Sun",696000,1989100000], ["Earth",6371,5973.6], ["Moon",1737,73.5], ["Mars",3390,641.85]] display(HTML(tabulate.tabulate(table, tablefmt='html')))
Google Collaboratory Oddities
Google colaboratory is like a hosted jupyter labs that has gdrive integrated. This can be handy but there are some adjustments required.
As part of the setup process you will need to "enable the app". I did this by right clicking in gdrive on an ipynb file and choosing "add app".
in the app search , search "Colaboratory"
https://colab.research.google.com/
Also you may need to give Colaboratory access to you gdrive.
<FIXME : how ? >
You can "mount" your gdrive in you ipynb files like this:
from google.colab import drive drive.mount('/content/gdrive')
Although you maybe be running an ipynb file from a subdirectory of your gdrive, an open() call will read from the root of your gdrive. You might get "file not found".
To fix this change your working directory:
not like this:
!cd gdrive/path/to/file
but like this:
%cd gdrive/path/to/file
and see the change with
!pwd