ipython

IPython notebook put code cells into columns

可紊 提交于 2020-01-06 14:41:12
问题 Is there a way to organize the code cells in a column format? I would like to write derivations in IPython notebook, but every auxiliary equation seems to break up my derivation. I'm using a module to write my equations and entering my equations into code cells, so I can't use simple html alignment inside markdown. Any help is greatly appreciated! An example of what I mean is that I would like my code cells to look like this... Instead of the regular vertically aligned cells... 回答1: After

dataframe re-indexing object unnecessarily preserved in memory

╄→尐↘猪︶ㄣ 提交于 2020-01-06 14:14:27
问题 In continuation from this question I've implemented 2 functions doing the same thing, one is using re-indexing and the other does not. the functions differ in the 3rd line: def update(centroid): best_mean_dist = 200 clust_members = members_by_centeriod[centroid] for member in clust_members: member_mean_dist = 100 - df.ix[member].ix[clust_members].score.mean() if member_mean_dist<best_mean_dist: best_mean_dist = member_mean_dist centroid = member return centroid,best_mean_dist def update1

How to start twisted's reactor from ipython

倖福魔咒の 提交于 2020-01-06 07:07:31
问题 I need to start a twisted'reactor from within ipython in a way that allows to go on interacting. Ipython's man page has references to twisted but I couldn't understand the way I should proceed. Documentation references IPython.kernel.twistedutil so that my impression is that it should be a standard solution... Thanks in advance sandro *:-) 回答1: Is this what you mean? http://code.activestate.com/recipes/410670-integrating-twisted-reactor-with-ipython/ This will start the Twisted reactor in a

How to subplot pie chart in plotly?

倾然丶 夕夏残阳落幕 提交于 2020-01-06 07:02:30
问题 How can I subplot 'pie1' in 'fig', so it be located at 'the first' position. this is how I am doing it but it doesn't work out import pandas as pd import numpy as np import seaborn as sns import plotly.offline as pyp import plotly.graph_objs as go from plotly import tools import plotly.plotly as py from plotly.offline import iplot,init_notebook_mode from IPython.core.display import HTML import plotly.io df1=pd.read_excel('file.xlsx',sheet_name='sheet1',index=False) con_pivot=pd.pivot_table

How to subplot pie chart in plotly?

北战南征 提交于 2020-01-06 07:01:12
问题 How can I subplot 'pie1' in 'fig', so it be located at 'the first' position. this is how I am doing it but it doesn't work out import pandas as pd import numpy as np import seaborn as sns import plotly.offline as pyp import plotly.graph_objs as go from plotly import tools import plotly.plotly as py from plotly.offline import iplot,init_notebook_mode from IPython.core.display import HTML import plotly.io df1=pd.read_excel('file.xlsx',sheet_name='sheet1',index=False) con_pivot=pd.pivot_table

Making function variables from imported module available in iPython interactive namespace

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-06 02:35:32
问题 I want to know how to make variables from functions in imported modules available in the IPython interactive namespace. I have some example code which I want to run from another script so I set it up as run_test.py: def run_test(): a = 5 if __name__ == "__main__": run_test() I import the module as follows and call the function: import run_test run_test.run_test() How do I make variable 'a' available in the interactive namespace? The only way I can do it is to make 'a' a global and run run

What does CompileError/LinkerError: “command 'gcc' failed with exit status 1” mean, when running %%cython-magic cell in IPython

我只是一个虾纸丫 提交于 2020-01-05 15:17:26
问题 Sometimes, when I run a %%cython-cell in an IPython-notebook I get a long backtrace with ends with a quite short error message: CompileError: command 'gcc' failed with exit status 1 or LinkError: command 'gcc' failed with exit status 1 On Windows the corresponding messages are: CompileError: command 'C:.\Microsoft Visual Studio\..\cl.exe' failed with exit status X and LinkError: command 'C:..\Microsoft Visual Studio\..\link.exe' failed with exit status YYYY Is it possible to get more precise

What does CompileError/LinkerError: “command 'gcc' failed with exit status 1” mean, when running %%cython-magic cell in IPython

你说的曾经没有我的故事 提交于 2020-01-05 15:17:22
问题 Sometimes, when I run a %%cython-cell in an IPython-notebook I get a long backtrace with ends with a quite short error message: CompileError: command 'gcc' failed with exit status 1 or LinkError: command 'gcc' failed with exit status 1 On Windows the corresponding messages are: CompileError: command 'C:.\Microsoft Visual Studio\..\cl.exe' failed with exit status X and LinkError: command 'C:..\Microsoft Visual Studio\..\link.exe' failed with exit status YYYY Is it possible to get more precise

Troubleshooting: Kernel always dies using IJulia in IPython notebook

馋奶兔 提交于 2020-01-05 14:13:23
问题 I recently began using julia, and I would like to use in with IPython Notebook/Jupyter. So, I installed julia using MacPorts, i.e. sudo port install julia . Following the installation instructions here: https://github.com/JuliaLang/IJulia.jl After the prompt, I used "Pkg.add("IJulia") to install IJulia. However, I cannot use Julia with IPython notebook. After opening the notebook with ipython notebook --profile=julia the kernel for the julia notebook dies instantly and cannot be restarted.

Printing to main stdout in IPython Notebook from other parallel engines

萝らか妹 提交于 2020-01-05 10:27:18
问题 I am currently working in an IPython Notebook. I am running a function across different engines and would like to see what it prints. Example: def simple(a): print a+40; return a+20 A = range(20); dview.map_sync(simple, A); I would like this functionality because I'm running a function that runs for a long time and I am using print statements to keep track of its progress. 来源: https://stackoverflow.com/questions/16430827/printing-to-main-stdout-in-ipython-notebook-from-other-parallel-engines