ipython

Why can't PySpark find py4j.java_gateway?

梦想与她 提交于 2019-12-17 10:23:21
问题 I installed Spark, ran the sbt assembly, and can open bin/pyspark with no problem. However, I am running into problems loading the pyspark module into ipython. I'm getting the following error: In [1]: import pyspark --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-1-c15ae3402d12> in <module>() ----> 1 import pyspark /usr/local/spark/python/pyspark/__init__.py in <module>() 61 62 from pyspark.conf import

cannot override sys.excepthook

末鹿安然 提交于 2019-12-17 09:57:25
问题 I try to customize behavior of sys.excepthook as described by the recipe. in ipython: :import pdb, sys, traceback :def info(type, value, tb): : traceback.print_exception(type, value, tb) : pdb.pm() :sys.excepthook = info :-- >>> x[10] = 5 ------------------------------------------------- Traceback (most recent call last): File "<ipython console>", line 1, in <module> NameError: name 'x' is not defined >>> pdb.pm() is not being called. It seems that sys.excepthook = info doesn't work in my

cannot override sys.excepthook

南笙酒味 提交于 2019-12-17 09:56:19
问题 I try to customize behavior of sys.excepthook as described by the recipe. in ipython: :import pdb, sys, traceback :def info(type, value, tb): : traceback.print_exception(type, value, tb) : pdb.pm() :sys.excepthook = info :-- >>> x[10] = 5 ------------------------------------------------- Traceback (most recent call last): File "<ipython console>", line 1, in <module> NameError: name 'x' is not defined >>> pdb.pm() is not being called. It seems that sys.excepthook = info doesn't work in my

How to hide <matplotlib.lines.Line2D> in IPython notebook

谁说胖子不能爱 提交于 2019-12-17 09:51:07
问题 I am plotting a NumPy array of values, I , using IPython notebook in %matplotlib inline mode with the plot command plt.plot(I,'o') . The resulting output is: <matplotlib.figure.Figure at 0x119e6ead0> Out[159]: [<matplotlib.lines.Line2D at 0x11ac57090>, <matplotlib.lines.Line2D at 0x11ac57310>, <matplotlib.lines.Line2D at 0x11ac57510>, <matplotlib.lines.Line2D at 0x11ac57690>, <matplotlib.lines.Line2D at 0x11ac57810>, <matplotlib.lines.Line2D at 0x11ac57990>, <matplotlib.lines.Line2D at

How to format IPython html display of Pandas dataframe?

让人想犯罪 __ 提交于 2019-12-17 08:21:26
问题 How can I format IPython html display of pandas dataframes so that numbers are right justified numbers have commas as thousands separator large floats have no decimal places I understand that numpy has the facility of set_printoptions where I can do: int_frmt:lambda x : '{:,}'.format(x) np.set_printoptions(formatter={'int_kind':int_frmt}) and similarly for other data types. But IPython does not pick up these formatting options when displaying dataframes in html. I still need to have pd.set

how to dynamically update a plot in a loop in ipython notebook (within one cell)

若如初见. 提交于 2019-12-17 07:01:20
问题 Environment: Python 2.7, matplotlib 1.3, IPython notebook 1.1, linux, chrome. The code is in one single input cell, using --pylab=inline I want to use IPython notebook and pandas to consume a stream and dynamically update a plot every 5 seconds. When I just use print statement to print the data in text format, it works perfectly fine: the output cell just keeps printing data and adding new rows. But when I try to plot the data (and then update it in a loop), the plot never show up in the

Prevent Python from caching the imported modules

旧巷老猫 提交于 2019-12-17 06:38:37
问题 While developing a largeish project (split in several files and folders) in Python with IPython, I run into the trouble of cached imported modules. The problem is that instructions import module only reads the module once, even if that module has changed! So each time I change something in my package, I have to quit and restart IPython. Painful. Is there any way to properly force reloading some modules? Or, better, to somehow prevent Python from caching them? I tried several approaches, but

How to read a .xlsx file using the pandas Library in iPython?

老子叫甜甜 提交于 2019-12-17 06:25:22
问题 I want to read a .xlsx file using the Pandas Library of python and port the data to a postgreSQL table. All I could do up until now is: import pandas as pd data = pd.ExcelFile("*File Name*") Now I know that the step got executed successfully, but I want to know how i can parse the excel file that has been read so that I can understand how the data in the excel maps to the data in the variable data. I learnt that data is a Dataframe object if I'm not wrong. So How do i parse this dataframe

How do I set custom CSS for my IPython/IHaskell/Jupyter Notebook?

不打扰是莪最后的温柔 提交于 2019-12-17 04:59:12
问题 I would line to apply a few simple changes to the appearance of my IPython/IHaskell/Jupyter Notebooks, such as rendered_html :link { text-decoration: none; } but I can't figure out how to do this. I've tried many of the solutions I've found by searching, e.g., placing CSS in ~/.ipython/profile_default/static/css/custom.css but none have any effect, and I suspect that given the recent changes to the Notebook architecture, the method for accomplishing this has changed and that the instructions

IOPub data rate exceeded in Jupyter notebook (when viewing image)

笑着哭i 提交于 2019-12-17 02:59:07
问题 I want to view an image in Jupyter notebook. It's a 9.9MB .png file. from IPython.display import Image Image(filename='path_to_image/image.png') I get the below error: IOPub data rate exceeded. The notebook server will temporarily stop sending output to the client in order to avoid crashing it. A bit surprising and reported elsewhere. Is this expected and is there a simple solution? (Error msg suggests changing limit in --NotebookApp.iopub_data_rate_limit .) 回答1: I ran into this using