ipython-notebook

iPython Notebook Print Above Last Line

不想你离开。 提交于 2019-12-13 02:09:49
问题 I have a notebook that is going to print off hundreds of lines. Is there anyway to have the next line print above the last one? As in: Output_n ... Output 2 Output 1 Instead of: Output1 Output2 ... Output_n 回答1: Kind of! from IPython.display import clear_output , then calling clear_output() will clear everything. Then you reprint everything starting from Output_n. It's... not ideal. Here's a link. 来源: https://stackoverflow.com/questions/24439629/ipython-notebook-print-above-last-line

R magic for ipython notebook runtime error turning off device on new server installed with anaconda

人盡茶涼 提交于 2019-12-13 02:09:45
问题 I loved the R magic in ipython notebook. I had to switch to a new server and heard that a huge headache can be taken out by installing everything through anaconda. However, R magic doesn't seem to work, which is half the reason I use ipython notebook. After installing anaconda, I open a notebook and simply type the following. %load_ext rmagic %%R print("hi") This produces a Runtime error I can't get to the bottom of: --------------------------------------------------------------------------

Unable to run ipython-notebook 2.7 with jupyterhub

ⅰ亾dé卋堺 提交于 2019-12-13 02:03:55
问题 I am trying to run ipython 2.7 notebooks with jupyterhub on Ubuntu 14.04 - but I haven't been able to figure out a way. Any suggestions? I know one needs to add kernels in the file ~/.ipython/kernels.json I have the following in this file: { "argv": ["python3", "-m", "IPython.kernel", "-f", "{connection_file}"], "display_name": "Python 3", "language": "python" } { "argv": ["python2.7", "-m", "IPython.kernel", "-f", "{connection_file}"], "display_name": "Python 2", "language": "python" } 回答1:

How to change the font in Markdown cells when they are in Edit Mode?

拈花ヽ惹草 提交于 2019-12-13 00:54:35
问题 I want to change the font type in Markdown cells when I am editing them. How Can I do that? I can edit the file .jupyter/custom/custom.css and change the font when they are "run": div.text_cell_render { font-family: 'Linux Libertine O'; font-size: 12pt; } As shown in the figure, the upper half is a Markdown cell in edit mode, and that is the place where I want to change the font. 回答1: A simple possibility is from IPython.display import HTML, display display(HTML('<style>.CodeMirror{font

Fisher's Exact in scipy as new column using pandas

旧巷老猫 提交于 2019-12-12 21:51:49
问题 Using ipython notebook, a pandas dataframe has 4 columns: numerator1 , numerator2 , denominator1 and denominator2 . Without iterating through each record, I am trying to create a fifth column titled FishersExact. I would like the value of the column to store the tuple returned by scipy.stats.fisher_exact using values (or some derivation of the values) from each of the four columns as my inputs. df['FishersExact'] = scipy.stats.fisher_exact( [[df.numerator1, df.numerator2], [df.denominator1 -

IPython Notebook previous cell content

拥有回忆 提交于 2019-12-12 18:24:16
问题 Is it possible in an IPython-Notebook cell to get the previous (above) cell content ? I can see previous output with %capture magic function but I don't find how to get the previous cell content. 回答1: I didn't find how to get the previous content cell in a cell. But I found another solution, creating a custom magic notebook function to capture the cell content and work with that. 回答2: You can get content of the last executed cell with: In[len(In)-2] 回答3: %recall jupyter_notebook_cell_number

PANDAS: Incorrect shape of indices passed, not sure how to fix it

只愿长相守 提交于 2019-12-12 14:21:13
问题 I am trying to generate a 7th column in a dataframe: arb_ser_num = 'zDfDD45' predefined_number = 878 DATE Q1 Q2 Q3 Q4 Q5 0 2012-08-20 00:00:00 [Atlantic, Z, dEdd] None None None None 1 2012-08-21 00:00:00 [Pacific, Y, dEdd] None None None None 2 2012-08-22 00:00:00 [Indian, Y, dRdd] None None None None 3 2012-08-23 00:00:00 [Meditar, Z, dEdd] None None None None 4 2012-08-24 00:00:00 [Arctic, Z, dRdd] None None None None df['Q6'] = df.apply(lambda row: get_q6(arb_ser_num, row, predefined

How to grab matplotlib plot as html in ipython notebook?

两盒软妹~` 提交于 2019-12-12 13:16:03
问题 I have an IPython Notebook that is using Pandas to back-test a rule-based trading system. I have a function that accepts various scalars and functions as parameters and outputs a stats pack as some tables and a couple of plots. For automation, I want to be able to format this nicely into a "page" and then call the function in a loop while varying the inputs and have it output a number of pages for comparison, all from a single notebook cell. The approach I am taking is to create IpyTables and

IPython Notebook throws ImportError – IPython doesn't

天大地大妈咪最大 提交于 2019-12-12 12:26:16
问题 I am trying to import pandas in an ipython (2.2.0, running python 3.3.5) notebook in my browser, which fails with [...] /usr/local/lib/python3.3/site-packages/numpy/add_newdocs.py in <module>() 11 from __future__ import division, absolute_import, print_function 12 ---> 13 from numpy.lib import add_newdoc 14 15 ############################################################################### /usr/local/lib/python3.3/site-packages/numpy/lib/__init__.py in <module>() 15 from .ufunclike import * 16

IPython notebook shows output in terminal

旧时模样 提交于 2019-12-12 10:48:51
问题 I'm using an IPython notebook ( ipython notebook & ), but when I try to print something to get any output by simply giving the variable name ans pressing Shift + Enter, instead of getting the output in notebook (next to the cell), I get it in the terminal from where I launch the notebook. I want to see the output in the notebook itself, next to the concerned cell. I'm facing this problem lately, previously it was working fine. 回答1: This code produces the same issue on my machine: import sys