ipython-notebook

Calling pylab.savefig without display in ipython

a 夏天 提交于 2019-11-26 15:07:08
问题 I need to create a figure in a file without displaying it within IPython notebook. I am not clear on the interaction between IPython and matplotlib.pylab in this regard. But, when I call pylab.savefig("test.png") the current figure get's displayed in addition to being saved in test.png . When automating the creation of a large set of plot files, this is often undesirable. Or in the situation that an intermediate file for external processing by another app is desired. Not sure if this is a

IPython Notebook output cell is truncating contents of my list

送分小仙女□ 提交于 2019-11-26 14:26:12
问题 I have a long list (about 4000 items) whose content is suppressed when I try to display it in an ipython notebook output cell. Maybe two-thirds is shown, but the end has a "...]", rather than all the contents of the list. How do I get ipython notebook to display the whole list instead of a cutoff version? 回答1: pd.options.display.max_rows = 4000 worked for me See : http://pandas.pydata.org/pandas-docs/stable/options.html 回答2: I know its a pretty old thread, but still wanted to post my answer

Unable to import a module from Python notebook in Jupyter

∥☆過路亽.° 提交于 2019-11-26 13:45:49
问题 I have an environment that I started using Anaconda and I successfully installed a module in it. I know it, because I can run python and then import tensorflow . This also works when through ipython . The problem is, that I cannot load the module from a notebook that I start using either ipython notebook or jupyter (even though I execute either from an active environment). I suspect it relates to the setting of ipython but I don't know how to debug and solve the issue. Any idea? Edit: Here

How do I increase the cell width of the Jupyter/ipython notebook in my browser?

会有一股神秘感。 提交于 2019-11-26 12:34:01
I would like to increase the width of the ipython notebook in my browser. I have a high-resolution screen, and I would like to expand the cell width/size to make use of this extra space. Thanks! edit: 5/2017 I now use jupyterthemes: https://github.com/dunovank/jupyter-themes and this command: jt -t oceans16 -f roboto -fs 12 -cellw 100% which sets the width to 100% with a nice theme. jjinking If you don't want to change your default settings, and you only want to change the width of the current notebook you're working on, you can enter the following into a cell: from IPython.core.display import

Inline animations in Jupyter

时间秒杀一切 提交于 2019-11-26 12:14:05
问题 I have a python animation script (using matplotlib\'s funcAnimation), which runs in Spyder but not in Jupyter. I have tried following various suggestions such as adding \"%matplotlib inline\" and changing the matplotlib backend to \"Qt4agg\", all without success. I have also tried running several example animations (from Jupyter tutorials), none of which have worked. Sometimes I get an error message and sometimes the plot appears, but does not animate. Incidentally, I have gotten pyplot.plot(

Pandas - Plotting a stacked Bar Chart

泪湿孤枕 提交于 2019-11-26 09:28:34
问题 I am trying to create a stacked bar graph that replicates the picture, all my data is separate from that excel spreadsheet. I cant figure out how to make a dataframe for it like pictured, nor can I figure out how to make the stacked bar chart. All examples I locate work in different ways to what I\'m trying to create. My dataframe is a csv of all values narrowed down to the following with a pandas dataframe. Site Name Abuse/NFF 0 NORTH ACTON ABUSE 1 WASHINGTON - 2 WASHINGTON NFF 3 BELFAST - 4

How can I check if code is executed in the IPython notebook?

北城余情 提交于 2019-11-26 08:13:57
问题 I have some Python code example I\'d like to share that should do something different if executed in the terminal Python / IPython or in the IPython notebook. How can I check from my Python code if it\'s running in the IPython notebook? 回答1: The question is what do you want execute differently. We do our best in IPython prevent the kernel from knowing to which kind of frontend is connected, and actually you can even have a kernel connected to many differents frontends at the same time. Even

Pandas: Setting no. of max rows

折月煮酒 提交于 2019-11-26 07:21:26
问题 I have a problem viewing the following DataFrame : n = 100 foo = DataFrame(index=range(n)) foo[\'floats\'] = np.random.randn(n) foo The problem is that it does not print all rows per default in ipython notebook, but I have to slice to view the resulting rows. Even the following option does not change the output: pd.set_option(\'display.max_rows\', 500) Does anyone know how to display the whole array? 回答1: Set display.max_rows : pd.set_option('display.max_rows', 500) For older versions of

Link Spark with iPython Notebook

半世苍凉 提交于 2019-11-26 06:37:18
问题 I have followed some tutorial online but they do not work with Spark 1.5.1 on OS X El Capitan (10.11) Basically I have run this commands download apache-spark brew update brew install scala brew install apache-spark updated the .bash_profile # For a ipython notebook and pyspark integration if which pyspark > /dev/null; then export SPARK_HOME=\"/usr/local/Cellar/apache-spark/1.5.1/libexec/\" export PYSPARK_SUBMIT_ARGS=\"--master local[2]\" fi run ipython profile create pyspark created a

Matplotlib and Ipython-notebook: Displaying exactly the figure that will be saved

大兔子大兔子 提交于 2019-11-26 04:01:28
问题 I am using ipython-notebook a lot at the moment for numerical analysis and plotting of data. In the process of preparing publication quality plots there is a lot of tweaking to get the layout just right, however I can\'t get ipython/matplotlib to show me what I will be saving in the browser. Making the process more painful than it should be because I have to keep opening the new output file to check it. Is there a way to get the image that is displayed inline to be the same as the image that