jupyter-notebook

Google map does not display correctly in jupyter notebook

拜拜、爱过 提交于 2020-04-10 04:04:29
问题 I'm trying to use google map API to visualize some data in jupyter notebook. Here is the code I used to display basic map in jupyter: import gmaps import os import json import gmaps.datasets gmaps.configure(api_key="AIz....") fig=gmaps.figure() fig After I ran the code, nothing was displayed. I used my own google API key and couldn't figure out why the map isn't displayed. I'm new to the geojson field, so any idea or thoughts is appreciated. 回答1: Did you make sure Widgets are enabled in your

Enable word wrap in JupyterLab code editor

依然范特西╮ 提交于 2020-04-10 03:03:32
问题 I would like to enable word wrap for the code cells in jupyterlab, but do not manage to find how. Already tried: File --> Settings --> Text Editor --> User Overrides: {"lineWrap": true} , which toggles the greyed-out "word wrap" in the "Editor" menu, but does not solve my problem This code also did not work (neither did simply "Cell": {...} ): "CodeCell": { "cm_config": { "lineWrapping": true } } 回答1: Try the following, { "codeCellConfig": { "lineWrap": "wordWrapColumn", "wordWrapColumn": 80

Juypter notebook - connect to the same kernel session from a command line ipython?

北战南征 提交于 2020-04-08 10:05:34
问题 Suppose I've a Jupyter notebook loaded in a browser. Is that possible to somehow run a command line ipython session which connect to the same kernel insance as the one used by the notebook (i.e they can see the same set of variables)? Thanks. 回答1: Yes! After starting/loading an IPython notebook, open up a terminal and connect a command line ipython session using the --existing parameter: jupyter console --existing By default, it will connect to the latest started IPython kernel. To select a

Restart ipython Kernel with a command from a cell

柔情痞子 提交于 2020-04-08 00:47:27
问题 Is it possible to restart an ipython Kernel NOT by selecting Kernel > Restart from the notebook GUI, but from executing a command in a notebook cell? 回答1: As Thomas K. suggested, here is the way to restart the ipython kernel from your keyboard: import os os._exit(00) 回答2: To define a function that restarts the Jupyter kernel, I've successfully used: from IPython.display import display_html def restartkernel() : display_html("<script>Jupyter.notebook.kernel.restart()</script>",raw=True) then

Access Jupyter notebook running on Docker container

我的未来我决定 提交于 2020-04-07 10:52:05
问题 I created a docker image with python libraries and Jupyter. I start the container with the option -p 8888:8888 , to link ports between host and container. When I launch a Jupyter kernel inside the container, it is running on localhost:8888 (and does not find a browser). I used the command jupyter notebook But from my host, what is the IP address I have to use to work with Jupyter in host's browser ? With the command ifconfig , I find eth0 , docker , wlan0 , lo ... Thanks ! 回答1: You need to

Problem getting R installed as kernel in Jupyter Notebook

夙愿已清 提交于 2020-04-07 08:05:46
问题 I'm trying to get R installed as a kernel for jupyter notebook. I am follwing the instructions at: https://irkernel.github.io/installation/ but when I try to install IRkernel I get: also installing the dependency 'uuid' trying URL 'https://cran.mtu.edu/src/contrib/uuid_0.1-4.tar.gz' Content type 'application/x-gzip' length 49544 bytes (48 KB) ================================================== downloaded 48 KB trying URL 'https://cran.mtu.edu/src/contrib/IRkernel_1.1.tar.gz' Content type

Problem getting R installed as kernel in Jupyter Notebook

删除回忆录丶 提交于 2020-04-07 08:04:54
问题 I'm trying to get R installed as a kernel for jupyter notebook. I am follwing the instructions at: https://irkernel.github.io/installation/ but when I try to install IRkernel I get: also installing the dependency 'uuid' trying URL 'https://cran.mtu.edu/src/contrib/uuid_0.1-4.tar.gz' Content type 'application/x-gzip' length 49544 bytes (48 KB) ================================================== downloaded 48 KB trying URL 'https://cran.mtu.edu/src/contrib/IRkernel_1.1.tar.gz' Content type

Project Juypter In / Out Bracket Notation

允我心安 提交于 2020-04-07 06:48:30
问题 I'm trying to learn how project Juypter works (formerly IPython Notebook) I've very confused by the cell identifier's In[] and Out[] I understand In = an input cell and Out = an output cell, but I'm baffled by the significance of the number within the brackets. What does that signify? It seem very prominent in the output, and I'm really baffled why I can't find any documentation on what that represents, and why it's there. I've been searching for the past hour. Search terms: "ipython notebook

importing functions from another jupyter notebook

雨燕双飞 提交于 2020-04-06 02:17:24
问题 I am trying to import a function from another jupyter notebook In n1.ipynb: def test_func(x): return x + 1 -> run this In n2.ipynb: %%capture %%run n1.ipynb test_func(2) Error: NameError Traceback (most recent call last)<ipython-input-2-4255cde9aae3> in <module>() ----> 1 test_func(1) NameError: name 'test_func' is not defined Any easy ways to do this please? 回答1: The nbimporter module helps us here: pip install nbimporter For example, with two notebooks in this directory structure: /src

How to call a fucntion from a .py file in Jupyter Notebook?

萝らか妹 提交于 2020-03-26 03:52:10
问题 I don't want to write the same function in each Jupyter Notebook files. It would be easier if I just need to edit the function once without the need to edit in each .ipynb file. The problem is, I have to restart kernel if I edit the .py file which will re-start everything. Is there any way I can simply call a function from several .pynb files? PS: After I have edited the .py, it does not affect the .ipynb file. 回答1: Yes, you need a make .py file with function defined and import that file then