ipython-notebook

Add jar to pyspark when using notebook

笑着哭i 提交于 2019-12-23 09:49:05
问题 I'm trying the mongodb hadoop integration with spark but can't figure out how to make the jars accessible to an IPython notebook. Here what I'm trying to do: # set up parameters for reading from MongoDB via Hadoop input format config = {"mongo.input.uri": "mongodb://localhost:27017/db.collection"} inputFormatClassName = "com.mongodb.hadoop.MongoInputFormat" # these values worked but others might as well keyClassName = "org.apache.hadoop.io.Text" valueClassName = "org.apache.hadoop.io

Jupyter Notebook Broken by Python 3.5

天大地大妈咪最大 提交于 2019-12-23 09:37:41
问题 When I updated my Python version from 3.4 to 3.5 (on Mac El Capitan), I reinstalled Jupyter but when I run it and create a new Python 3 notebook, it immediately tells me that there has been a kernel error and if I click on this, then I get this error message: Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/notebook/base/handlers.py", line 436, in wrapper result = yield gen.maybe_future(method(self, *args, **kwargs)) File "/usr/local/lib/python3.5/site-packages

Closed IPython Notebook that was running code

不羁岁月 提交于 2019-12-23 09:36:29
问题 How it works? I got some code running in an IPython Notebook. Some iterative work. Accidentally I closed the browser with the running Notebook, but going back to the IPython Dashboard I see that this particular Notebook hasn't Shutdown, so if I open the Notebook again I see the [*] in front of my code that it was executing. I even can hear my PC still running the code, but it doesn't return me any new output of the print statements. Can I wait and eventually continue with the output, or my PC

Jupyter notebook xgboost import

痞子三分冷 提交于 2019-12-23 07:52:08
问题 I have the problem below (I'm on a MAC) I can import xgboost from python2.7 or python3.6 with my Terminal but the thing is that I can not import it on my Jupyter notebook. import xgboost as xgb ModuleNotFoundError Traceback (most recent call last) in () ----> 1 import xgboost as xgb ModuleNotFoundError: No module named 'xgboost' Although I write : !pip3 install xgboost It prints that : Requirement already satisfied: xgboost in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6

convert ipython notebook to mediawiki

≡放荡痞女 提交于 2019-12-22 18:02:09
问题 I would like to convert an ipython notebook to mediawiki markup. I had two ideas how to do that: Customize an export for the nbconvert tool. Export to LaTeX first and then use pandoc to convert it to mediawiki markup. I couldn't find anything on the first option. The problem for the second option is that LaTeX output puts in a lot of custom commands which are not converted into <source lang='python'> ... </source> tags correctly. Does anybody have a good idea? 回答1: you can probably pitch-in

Linking ipython widget button and slider values

你离开我真会死。 提交于 2019-12-22 10:38:09
问题 I'm trying to figure out how to link the value of a counter controlled by button widgets to the value of a slider widget. The goal here is use ipython widgets to create a simple "vcr-like" interface with three widgets: an IntSlider and two Button s that increment a counter and decrement a counter. This is what I've got: import ipywidgets as widgets from functools import partial from IPython.display import display import traitlets class Counter: def __init__(self, initial=0): self.value =

Ipython Notebook: Default Initialization Python Code

眉间皱痕 提交于 2019-12-22 10:11:12
问题 I use iPython Notebook for scientific applications and I'm always plotting experimental data sets. The default image rendering and color cycling behavior of the combination of iPython Notebook and Matplotlib is pretty bad, but it's great after the following tweaks. # ipython notebook specific %pylab inline # imports from matplotlib import pyplot as plt import matplotlib as mpl from seaborn.apionly import set_palette from IPython.display import set_matplotlib_formats # configure plotting set

Python multiprocessing pool stuck

。_饼干妹妹 提交于 2019-12-22 08:19:12
问题 I'm trying to run some sample code of the multiprocessing.pool module of python, found in the web. The code is: def square(x): return x * x if __name__ == '__main__': pool = Pool(processes=4) inputs = [0, 1, 2, 3, 4] outputs = pool.map(square, inputs) But when i try to run it, it never finsh the execution and i have to restart the kernel of my IpythonNotebook notebook. What's the problem? 回答1: As you may read from the answer pointed out by John in the comments, multiprocessing.Pool , in

Plot an IPython Notebook figure inline with fig.show()?

房东的猫 提交于 2019-12-22 07:37:15
问题 I'm calling the inline mode for IPython Notebook using; %pylab inline And the following code plots a figure immediately at the cell; fig = plt.figure() axes = fig.add_axes([0, 0, 1, 1]) However I would like to create the plot/axes etc. in one cell, and plot later using maybe; fig.show() How do I gain more control of the inline mode? If I don't use %pylab inline, it creates the plot in a seperate window which I don't want (and it usually freezes the window). Versions; Numpy: 1.7.0 Matplotlib:

How to work with interactively-defined classes in IPython.parallel?

不问归期 提交于 2019-12-22 05:46:05
问题 Context In an interactive prototyping development on the notebook connected to a cluster, I would like to define a class that is both available in the client __main__ session and interactively update on the cluster engine nodes to be able to move instances of that class around by passing such instances a argument to a LoadBalanced view. The following demonstrates the typical user session: First setup the parallel clustering environment: >>> from IPython.parallel import Client >>> rc = Client(