ipython-notebook

How to show PIL Image in ipython notebook

How to show PIL Image in ipython notebook Question: This is my code from PIL import Image pil_im = Image.open(‘data/empire.jpg’) I would like to do some image manipulation on it, and then show it on screen. I am having problem with showing PIL Image in python notebook. I have tried: print pil_im And just pil_im …

Total answers: 12

Verifying PEP8 in iPython notebook code

Verifying PEP8 in iPython notebook code Question: Is there an easy way to check that iPython notebook code, while it’s being written, is compliant with PEP8? Asked By: Seanny123 || Source Answers: Install the pep8 extension for ipython notebook using the following command : %install_ext https://raw.githubusercontent.com/SiggyF/notebooks/master/pep8_magic.py Refer the official docs for more info. After that …

Total answers: 7

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

How to hide <matplotlib.lines.Line2D> in IPython notebook Question: 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>, …

Total answers: 3

ipython notebook clear cell output in code

ipython notebook clear cell output in code Question: In a iPython notebook, I have a while loop that listens to a Serial port and print the received data in real time. What I want to achieve to only show the latest received data (i.e only one line showing the most recent data. no scrolling in …

Total answers: 6

IPython Notebook – early exit from cell

IPython Notebook – early exit from cell Question: I’d like to programmatically exit a cell early in IPython Notebook. exit(0), however, kills the kernel. Whats the proper way to do this? I’d prefer not to split the cell or manually halt execution. Asked By: watsonic || Source Answers: This is far from “proper” but one …

Total answers: 6

Format certain floating dataframe columns into percentage in pandas

Format certain floating dataframe columns into percentage in pandas Question: I am trying to write a paper in IPython notebook, but encountered some issues with display format. Say I have following dataframe df, is there any way to format var1 and var2 into 2 digit decimals and var3 into percentages. var1 var2 var3 id 0 …

Total answers: 10

Pandas – Plotting a stacked Bar Chart

Plotting a stacked Bar Chart Question: I am trying to create a stacked bar graph with pandas that replicates the picture, all my data is separate from that excel spreadsheet. I can’t figure out how to make a dataframe for it like pictured, nor can I figure out how to make the stacked bar chart. …

Total answers: 5

Converting to (not from) ipython Notebook format

Converting to (not from) ipython Notebook format Question: IPython Notebook comes with nbconvert, which can export notebooks to other formats. But how do I convert text in the opposite direction? I ask because I already have materials, and a good workflow, in a different format, but I would like to take advantage of Notebook’s interactive …

Total answers: 10

Error using BeautifulSoup

Error using BeautifulSoup Question: I want to extract some data from a website. I saved it as ‘Webpage, HTML Only’, in a file called soccerway.html on my Desktop. Afterwards I wrote the following command using an IPython notebook: from bs4 import BeautifulSoup soup=BeautifulSoup(open(“soccerway.html”)) I get the following error: IOError: [Errno 2] No such file or …

Total answers: 2

Automatically run %matplotlib inline in IPython Notebook

Automatically run %matplotlib inline in IPython Notebook Question: Every time I launch IPython Notebook, the first command I run is %matplotlib inline Is there some way to change my config file so that when I launch IPython, it is automatically in this mode? Asked By: 8one6 || Source Answers: I think what you want might …

Total answers: 7