jupyter-notebook

Installing jupyter-contrib-nbextension on Google Colab

落爺英雄遲暮 提交于 2020-01-04 15:58:28
问题 I wanted to install hinterland for use in google colab. I followed the installation instructions on official page Basically I did the following steps: !pip install https://github.com/ipython-contrib/jupyter_contrib_nbextensions/tarball/master !jupyter contrib nbextension install --user Now when I want to enable any particular extension say 'hinterland' I do the following: !jupyter nbextension enable /usr/local/lib/python3.6/dist-packages/jupyter_contrib_nbextensions/nbextensions/hinterland

Pass variable from Jupyter notebook to python script

扶醉桌前 提交于 2020-01-04 05:30:36
问题 I would like to define a variable in a Jupyter notebook and then pass it to a python script. For example, in the notebook: a = [1, 2, 3, 4] %run example.py print foo And in example.py b = [5, 8, 9, 10] foo = a + b Of course, this returns an error because a has not been defined in example.py. However, if example.py has instead a = [1, 2, 3, 4] b = [5, 8, 9, 10] foo = a + b Then the Jupyter notebook can "see" foo after the script is run and print it, even though foo was not defined in the

PyCharm Notebook: Widget javascript not detected

无人久伴 提交于 2020-01-04 04:26:30
问题 This python code in the PyCharm notebook viewer produces the error: Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension" Code: from ipywidgets import widgets from IPython.display import display text = widgets.Text() display(text) I did enable the extension with the suggested command from the error. The code works from a web-based jupyter notebook session. I

Center align outputs in ipython notebook

旧巷老猫 提交于 2020-01-04 02:15:07
问题 I want to center align the outputs (which includes text and plots) in my ipython notebook . Is there a way in which I can add styling in the same notebook for the same? Code or screenshot examples would greatly help. 回答1: Try running this in a code-cell to override the default CSS for an output cell: from IPython.display import display, HTML CSS = """ .output { align-items: center; } """ HTML('<style>{}</style>'.format(CSS)) Example You can see here that the right side of the table is cut-off

Gensim mallet CalledProcessError: returned non-zero exit status

前提是你 提交于 2020-01-04 01:56:08
问题 I'm getting an error while trying to access gensims mallet in jupyter notebooks. I have the specified file 'mallet' in the same folder as my notebook, but cant seem to access it. I tried routing to it from the C drive but I still get the same error. Please help :) import os from gensim.models.wrappers import LdaMallet #os.environ.update({'MALLET_HOME':r'C:/Users/new_mallet/mallet-2.0.8/'}) mallet_path = 'mallet' # update this path ldamallet = gensim.models.wrappers.LdaMallet(mallet_path,

Jupyter notebook custom.js not applied when using “Restarting & Run All”

此生再无相见时 提交于 2020-01-04 01:51:23
问题 In order to get the name of a running Jupyter notebook, I first added the following line in ~/.jupyter/custom/custom.js // Create a nb_name variable with the name of the notebook IPython.notebook.kernel.execute('nb_name = "' + IPython.notebook.notebook_name + '"'); Then on my notebook when I run a cell with: print(nb_name) I get: NameError Traceback (most recent call last) <ipython-input-1-7e37f787d8df> in <module>() ----> 1 print(nb_name) NameError: name 'nb_name' is not defined To solve

Is it possible to import big oracle database(600+ GB) to jupyter notebook?

青春壹個敷衍的年華 提交于 2020-01-03 19:41:17
问题 Is it possible to import a large database to the jupyter notebook? Is it restricted to certain types of database and is it possible to do with oracle database? 回答1: Is it possible to import [600+ GB] to the jupyter notebook? No. At the moment it seems Jupyter has a maximum limit of 100MB. Check out the source. Notebooks are for sharing analyses and the data to drive them. They are not intended for the sort of heavy duty data crunching suggested by 600GB. Is it restricted to certain types of

Anaconda libstdc++.so.6: version `GLIBCXX_3.4.20' not found

不羁的心 提交于 2020-01-03 18:53:10
问题 I am using anaconda for python and I face this problem I tried a lot to solve this error, but still not solved. I used the following commands so far sudo apt-get install libstdc++6 sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade conda install libgcc in this link a solution provided but I still don't know how to do that 回答1: I solved this by conda install libgcc=5.2.0 回答2: I meet the same problem, which is when I run

Numpy random seed valid for entire jupyter notebook

旧巷老猫 提交于 2020-01-03 16:54:33
问题 I'm using functions from numpy.random on a Jupyter Lab notebook and I'm trying to set the seed using numpy.random.seed(333) . This works as expected only when the seed setting is in the same notebook cell as the code. For example, if I have a script like this: import numpy as np np.random.seed(44) ll = [3.2,77,4535,123,4] print(np.random.choice(ll)) print(np.random.choice(ll)) The output from both np.random.choice(ll) will be same, because the seed is set: # python seed.py 4.0 123.0 # python

How to pass variables from javascript to python in Jupyter?

百般思念 提交于 2020-01-03 15:51:09
问题 As I understand it, I should be able to print the variable foo in the snippet below. from IPython.display import HTML HTML(''' <script type="text/javascript"> IPython.notebook.kernel.execute("foo=97") </script> ''') print(foo) Instead, I see this error message: NameErrorTraceback (most recent call last) <ipython-input-2-91b73ee49ec6> in <module>() 5 </script> 6 ''') ----> 7 print(foo) NameError: name 'foo' is not defined I'm trying to use this answer but struggling to make it work. FWIW, this