jupyter-notebook

Uploading files using Browse Button in Jupyter and Using/Saving them

妖精的绣舞 提交于 2019-12-06 08:25:48
问题 I came across this snippet for uploading files in Jupyter however I don't know how to save this file on the machine that executes the code or how to show the first 5 lines of the uploaded file. Basically I am looking for proper commands for accessing the file after it has been uploaded: import io from IPython.display import display import fileupload def _upload(): _upload_widget = fileupload.FileUploadWidget() def _cb(change): decoded = io.StringIO(change['owner'].data.decode('utf-8'))

How to make one slider/widget update multiple plots in Bokeh/Python/Pywidgets?

别等时光非礼了梦想. 提交于 2019-12-06 07:59:05
Using Jupyter notebook, how to have one slider interactively update two independent functions in two figures? There is a link to a similar question without answer here . Using Bokeh Javascript Callback slider power example , I tried adding a second set of variables x and y but keep using the same callback. The graphs do not update anymore. Any suggestions? I also was trying to do the same with Pywidget but did not get anywhere. I would prefer using IPywidget if there is a solution there. The end goal is to have a dashboard with an input composed of multiple slider, and an output composed of

Jupyter notebook will not open from command prompt

江枫思渺然 提交于 2019-12-06 07:21:54
问题 I am trying to work with Jupyter notebook on Windows 10 (64-bit). I downloaded Anaconda3 5.0.1. Now I should be able to open the jupyter notebook from the command prompt by typing jupyter notebook. However I get the following error: The only way I am able to open jupyter notebook is from the Anaconda navigator. However, I would like to change the directory from which the notebook opens and none of the solutions here How to change the Jupyter start-up folder work if I cannot open jupyther from

Awk print with pipes not working iPython in Jupyter Notebook

こ雲淡風輕ζ 提交于 2019-12-06 07:16:44
So the command below does not give me any output in Jupyter Notebook with iPython: IP = '62.172.72.131' !cat hits.csv | grep {IP} | awk '{print $1}' I have tried both double and single "$" sign and none of them works. If I only use one pipe in the command, it works fine. For example: IP = '62.172.72.131' !cat hits.csv | grep {IP} !cat hits.csv | awk '{print $1}' Anyone know why this is happening? Thanks! I think I figured this out. The "$" and "{" and "}" are all special characters in iPython, so I have to escape them by doubling them. IP = '62.172.72.131' !cat hits.csv | grep {IP} | awk '{

AttributeError: module 'boto' has no attribute 'plugin'

青春壹個敷衍的年華 提交于 2019-12-06 06:45:35
I'm running a VM on Google Cloud Platform using Jupyter notebook with word2vec models. I have the following code snippet: from gensim.models import Word2Vec amazon_word2vec = Word2Vec(model, min_count=1, size=100) And it results in the error: AttributeError: module 'boto' has no attribute 'plugin' What is the solution to the above problem? pip install google-compute-engine install google compute engine and restart your vm and it works fine. 来源: https://stackoverflow.com/questions/52414249/attributeerror-module-boto-has-no-attribute-plugin

D3 4.0+ does not create a global d3 variable when imported into Jupyter Notebook

六眼飞鱼酱① 提交于 2019-12-06 06:00:38
问题 The following will fail with a JavaScript ReferenceError : from IPython.display import HTML, display display(HTML(""" <script src="https://d3js.org/d3.v4.js"></script> <script> console.log(d3); </script> """)) Why is that? The equivalent D3 version 3.x will work (albeit on the second try, for me): from IPython.display import HTML, display display(HTML(""" <script src="https://d3js.org/d3.v3.js"></script> <script> console.log(d3); </script> """)) This is the most relevant question/answer I

Interactive Timer in Jupyter Notebook

╄→尐↘猪︶ㄣ 提交于 2019-12-06 06:00:33
问题 I have a function which records data and takes a while to complete. While the data is being recorded, I would like to have a button which, upon being pressed, displays how much time has elapsed since the data acquisition has started. Is this possible to do in Jupyter? I'm having issues as the data acquisition blocks the widget from activating, and if I try and run the widget in the background, it doesn't receive the on_click event until the data acquisition has finished. On the other hand, if

How do I get data from selected points in an offline plotly python jupyter notebook?

允我心安 提交于 2019-12-06 05:54:08
问题 Example code: from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot import plotly.graph_objs as go import numpy as np N = 30 random_x = np.random.randn(N) random_y = np.random.randn(N) # Create a trace trace = go.Scatter( x = random_x, y = random_y, mode = 'markers' ) data = [trace] # Plot and embed in ipython notebook! iplot(data, filename='basic-scatter') [ ] How do I get a copy of the x,y data, or the indices from the selection? 回答1: So if you want to use javascript

How can I jump to the cell currently being run in a Jupyter notebook?

狂风中的少年 提交于 2019-12-06 05:48:32
问题 After I select run all , run all above , or run all below in a Jupyter notebook, how can I jump to the cell currently being run? 回答1: Thank you for this idea, Aaron. But it works only once on a full run, so it needs to be improved to be more useful. I have expanded it into a shortcut that can be used many times during the execution of the notebook. add this to ~/.jupyter/custom/custom.js : // Go to Running cell shortcut Jupyter.keyboard_manager.command_shortcuts.add_shortcut('Alt-I', { help :

Are unicode identifiers in python bad practice?

只谈情不闲聊 提交于 2019-12-06 05:38:30
I am getting into machine learning, and to document my code, I will write LaTeX math versions of my functions, right next to the code in an Jupyter/IPython notebook. The mathematical definitions include many Greek symbols, so I thought that I might as well use the Greek symbols in function and variable names, since that's possible in python. Would this be bad practice? It seems a good use case under these assumptions: the audience is mathematically versed, you make use of a lot of Jupyter Notebook features such as inline plotting and table display (e.g. pandas) so that the use of your code