ipython

remove nbconvert --to html 'in' and 'out' prompts based on cell metadata

ぐ巨炮叔叔 提交于 2019-12-09 13:42:15
问题 I'd like to remove the red and blue 'In' and 'Out' prompts when running nbconvert --to html , based on cell metadata. With cell metadata such as: {'cell_tags': {'cutcode_html': true}} The following sucessfully removes the 'In' prompt: {% block input_group %} {% if cell['metadata'].get('cell_tags',{}).get('cutcode_html','') == True -%} <div></div> {% else %} {{ super() }} {% endif %} {% endblock input_group %} I'd like to do the equivalent thing for the output prompt. There has been discussion

Working with curses in IPython. How can I improve this?

孤街醉人 提交于 2019-12-09 11:47:54
问题 I've found a way to interactively work with curses while still enjoying most of the benefits of IPython. It works, with some limitations, but not as well as I'd like. The original problem, of course, is that I'd like to be able to work with my interactive Python session while having it control a terminal screen, using the curses (ncurses) module (or urwid, for example). One solution is to write a simple TCP server with a simple event loop that evaluates each string it reads from the socket

Jupyter notebook permission error

回眸只為那壹抹淺笑 提交于 2019-12-09 09:56:47
问题 I'm having some issues with opening Jupyter. I just installed Anaconda, but got the same error as before when I try to write "Jupyter notebook" in terminal. Johans-MBP:~ JDMac$ Jupyter notebook Traceback (most recent call last): File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 501, in get value = obj._trait_values[self.name] KeyError: 'runtime_dir' During handling of the above exception, another exception occurred: Traceback (most recent call last): File

Copying excel data into a python list in IPython using clipboard?

浪子不回头ぞ 提交于 2019-12-09 09:10:20
问题 Is there a way to perform the following workflow: Select cells in an Excel spreadsheet Copy them using Ctrl+C Get the content the selected cells in a form of a python list or numpy array into the IPython shell? 回答1: Update: It seems that the readline thing that @PauloAlmeida mentioned is turned on by default in the 1.0 verison of IPython. So all you have to do is: from numpy import array Copy the cells from the spreadsheet Hit Alt+V instead of Ctrl+V And you will get in IPython something like

How to add python console in spyder

对着背影说爱祢 提交于 2019-12-09 08:35:26
问题 After upgrade spyder version 3.2.1 .I con't find the python console in spyder. It is inconvenient when i plot data interactively though the Ipython console.How can i add the python console to the spyder. 回答1: ( Spyder developer here ) The Python console was completely removed in Spyder 3.2.0 and it's not coming back. For the reasons to do that, please read this Github issue. If you want to create interactive plots in the IPython console, you need to change your graphics backend to Automatic

Python 2.7 - IPython 'raw_input' and appending to a list - adds 'u' before each item

好久不见. 提交于 2019-12-09 07:42:27
I'm using Python 2.7 on Mac OSX Lion. I'm using IPython with the Pandas 0.11.0 , Numpy and Statsmodels packages. I'm writing a function that allows the user to do logistic regression on a file, specifying which variables to be used in building the model, which should be transformed into dummy variables and which variable should be the independent variable. When I do the following, for instance: cols_to_keep = [] print (df.columns) i = eval(raw_input('How many of these variables would you like to use in logistic regression?: ')) while i != 0: i = i - 1 print (df.columns) addTo = raw_input(

Import custom modules on IPython.parallel engines with sync_imports()

不想你离开。 提交于 2019-12-09 05:45:34
问题 I've been playing around with IPython.parallel and I wanted to use some custom modules of my own, but haven't been able to do it as explained on the cookbook using dview.sync_imports() . The only thing that has worked for me was something like def my_parallel_func(args): import sys sys.path.append('/path/to/my/module') import my_module #and all the rest and then in the main just to if __name__=='__main__': #set up dview... dview.map( my_parallel_func, my_args ) The correct way to do this

How can I configure ipython to display integers in hex format?

*爱你&永不变心* 提交于 2019-12-09 05:15:41
问题 Here's the default behavior: In [21]: 255 Out[21]: 255 And here's what I would like: In [21]: 255 Out[21]: FF Can I setup ipython to do that? 回答1: You can do this by registering a special display formatter for ints: In [1]: formatter = get_ipython().display_formatter.formatters['text/plain'] In [2]: formatter.for_type(int, lambda n, p, cycle: p.text("%X" % n)) Out[2]: <function IPython.lib.pretty._repr_pprint> In [3]: 1 Out[3]: 1 In [4]: 100 Out[4]: 64 In [5]: 255 Out[5]: FF If you want this

How do I configure mathjax for iPython notebooks?

馋奶兔 提交于 2019-12-09 04:50:31
问题 I'm trying to find a way for mathjax to not use STIX fonts for math in my iPython notebook. Instead, I'd much rather have it use the 'TeX' fonts. According to the documentation for Mathjax I should use: MathJax.Hub.Config({ "HTML-CSS": { preferredFont: "TeX" } }); That being said, I'm not sure where to put this. I've already tried putting this chunk of code into my custom.js file pertaining to my own ipython profile, but it doesn't work. Ideally, I'd like to make ipython profile specific

Running an IPython/Jupyter notebook non-interactively

谁说我不能喝 提交于 2019-12-09 04:00:23
问题 Does anyone know if it is possible to run an IPython/Jupyter notebook non-interactively from the command line and have the resulting .ipynb file saved with the results of the run. If it isn't already possible, how hard would it be to implement with phantomJS, something to turn the kernel on and off, and something to turn the web server on and off? To be more specific, let's assume I already have a notebook original.ipynb and I want to rerun all cells in that notebook and save the results in a