ipython

Weird behaviour with semicolon before function call in ipython/ipython notebook

六月ゝ 毕业季﹏ 提交于 2019-12-30 20:34:30
问题 I stumbled upon some strange behaviour using ipython-notebook and wondered what, if any, the purpose was. If you enter a semicolon before a function call, you get the result of applying the function to a string which reflects all the code after the function name. For example, if I do ;list('ab') I get the result of list("('ab')") : In [138]: ;list('ab') Out[138]: ['(', "'", 'a', 'b', "'", ')'] I'm using jupyter with ipython 4 . It happens in ipython as well as ipython notebook . Has anyone

ipython on MacOS 10.10 - command not found

耗尽温柔 提交于 2019-12-30 18:25:47
问题 I'm trying to get ipython working in Mac OS 10.10. problem: $ ipython returns -bash: ipython: command not found context: I'm running python2.7 on MacOS 10.10. I installed python via brew. Some info: which python = /usr/local/bin/python brew info python = python: stable 2.7.10 (bottled), HEAD Interpreted, interactive, object-oriented programming language https://www.python.org /usr/local/Cellar/python/2.7.10_2 (4977 files, 77M) * To install ipython I ran pip install ipython[all] so... pip show

Segfault 11 with pandas with Python v2.7.6 RC1 on Mac OS X 10.9

你说的曾经没有我的故事 提交于 2019-12-30 11:39:11
问题 In [1]: import json In [2]: path = 'ch02/usagov_bitly_data2012-03-16-1331923249.txt' In [3]: from pandas import DataFrame, Series; In [4]: records = [json.loads(line) for line in open(path)] In [5]: frame = DataFrame(records) In [6]: frame['tz'][:10] Segmentation fault: 11 Any access to frame results in a segfault. I have already upgraded to Python 2.7.6 RC1. Also happened in 2.7.5, also happens outside ipython. What am I to do? 回答1: This appears to be a bug in Numpy that has been fixed

Prevent ipython from storing outputs in Out variable

試著忘記壹切 提交于 2019-12-30 10:52:48
问题 I'm currently working with pandas and ipython. Since pandas dataframes are copied when you perform operations with it, my memory usage increases by 500 mb with every cell. I believe it's because the data gets stored in the Out variable, since this doesn't happen with the default python interpreter. How do I disable the Out variable? 回答1: The first option you have is to avoid producing output. If you don't really need to see the intermediate results just avoid them and put all the computations

How to configure IPython to execute cell blocks the same way as a plain Python REPL does?

谁说胖子不能爱 提交于 2019-12-30 10:01:27
问题 Vanilla Python REPL: >>> 'na' 'na' >>> for i in range(4): ... f'{_+_}' ... else: ... 'batman' ... 'nana' 'nananana' 'nananananananana' 'nananananananananananananananana' 'batman' >>> IPython REPL with same interpreter: >>> 'na' 'na' >>> for i in range(4): ... f'{_+_}' ... else: ... 'batman' ... >>> _ 'na' This difference is apparently related to the mode in which IPython compiles code, and unrelated to the display hook. Is it possible to configure IPython to compile/exec cell blocks as a

Change default options in pandas

泪湿孤枕 提交于 2019-12-30 07:14:08
问题 I'm wondering if there's any way to change the default display options for pandas. I'd like to change the display formatting as well as the display width each time I run python, eg: pandas.options.display.width = 150 I see the defaults are hard-coded in pandas.core.config_init . Is there some way in pandas to do this properly? Or if not, is there some way to set up ipython at least to change the config each time I import pandas? Only thing I can think of is making my own mypandas library that

Change default options in pandas

别说谁变了你拦得住时间么 提交于 2019-12-30 07:14:04
问题 I'm wondering if there's any way to change the default display options for pandas. I'd like to change the display formatting as well as the display width each time I run python, eg: pandas.options.display.width = 150 I see the defaults are hard-coded in pandas.core.config_init . Is there some way in pandas to do this properly? Or if not, is there some way to set up ipython at least to change the config each time I import pandas? Only thing I can think of is making my own mypandas library that

Can't get ipython console in spyder

别等时光非礼了梦想. 提交于 2019-12-30 06:19:09
问题 I'm having trouble getting an ipython console in Spyder. It only offers a python interpreter under the "interpreters" menu. I've seen this issue for a couple of others in Stackoverflow, but didn't have much joy with the proffered solutions. I'm running linux Mint 16 and have installed both ipython (v 1.1.0) and Spyder (v 2.2.1) the easy way via the Mint Software Manager . I made sure that I also installed ipython-qtconsole and verified that I could run it from a terminal (i.e. ipython

Insert/overwrite shortcut key in Jupyter

回眸只為那壹抹淺笑 提交于 2019-12-30 05:59:42
问题 What is the Jupyter shortcut key to toggle between insert and overwrite mode whilst editing? I must keep hitting it by accident and then cannot turn off overwrite mode. I have looked at the list of shortcuts in Jupyter and online, but I could not find a match. I am working on Firefox on a Linux virtual machine running on a Mac. 回答1: Finally tracked down the problem: it was a Linux one to do with enabling Numlock. As Numlock was not turned on, the 0-key on the number keypad was acting as a

ipywidgets: Update one widget based on results from another

寵の児 提交于 2019-12-30 03:23:04
问题 I am using widgets in IPython that allows the user to repeatedly search for a phrase and see the results (different titles) in another widget (a selection widget) and then select one of the results. In short: search_text = widgets.Text(description = 'Search') search_result = widgets.Select(description = 'Select table') def search_action(sender): phrase = search_text.value df = search(phrase) # A function that returns the results in a pandas df titles = df['title'].tolist() search_result