ipython

Which character encoding is the IPython terminal using?

泪湿孤枕 提交于 2019-12-24 00:22:46
问题 I used to think I had this whole encoding stuff pretty figured out. I seem to be wrong because I can't explain what's happening here. What I was trying to do is to use the tabulate module to print a nicely formatted table using from tabulate import tabulate s = tabulate([[1,2],[3,4]], ["x","y"], tablefmt="fancy_grid") print(s) in IPython 3.5.0's interactive console under Windows 10. I expected the result to be ╒═════╤═════╕ │ x │ y │ ╞═════╪═════╡ │ 1 │ 2 │ ├─────┼─────┤ │ 3 │ 4 │ ╘═════╧════

Matplotlib text won't display in xkcd font

限于喜欢 提交于 2019-12-23 20:40:23
问题 When using xkcd() with matplotpib, none of the font is displaying in the usual comic font. Did something change or am I doing something wrong? x = df['Time'] y = df['Adjustment'] fig = plt.figure() ax = fig.add_subplot(1,1,1) ax1 = fig.add_subplot(1,1,1) ax1.plot(x,y) ax1.xaxis.set_visible(False) ax1.yaxis.set_visible(False) plt.axvline(x=2.3, color='k', ls='dashed') plt.axvline(x=6, color='k', ls='dashed') ax.text(4,4,'Culture Shock', size=16) plt.title('Test title') plt.xkcd() plt.show()

iPython notebook avoid printing within a function

≡放荡痞女 提交于 2019-12-23 20:31:05
问题 I want to prevent a function to print in iPython notebook. In standard python one can prevent printing some lines of code as answered in the question: To prevent a function from printing in the batch console in Python However this method do not work in iPython notebook, losing the output until a restart of the Kernel. The most similar feature I found is to avoid a full cell to display using the magic function: %%capture capt However this magic function blocks the whole cell, is there any way

Numpy: apparent memory error

我的未来我决定 提交于 2019-12-23 19:29:52
问题 Using Python/Numpy, I'm trying to import a file; however, the script returns an error that I believe is a memory error: In [1]: import numpy as np In [2]: npzfile = np.load('cuda400x400x2000.npz') In [3]: U = npzfile['U'] --------------------------------------------------------------------------- SystemError Traceback (most recent call last) <ipython-input-3-0539104595dc> in <module>() ----> 1 U = npzfile['U'] /usr/lib/pymodules/python2.7/numpy/lib/npyio.pyc in __getitem__(self, key) 232 if

How can I import one Jupyter notebook into another

送分小仙女□ 提交于 2019-12-23 19:15:11
问题 Apparently it's possible to import one Jupyter notebook into another. The linked page has quite a bit of code to do it. Am I supposed to add that code to the importing notebook? The page isn't clear about it. It's supposed to be a general solution, so it doesn't make sense to add all that code to all notebooks that import other notebooks. Any help would be appreciated. Thanks. 回答1: Yes, you can add all of that code to a notebook if you want. And yes, you shouldn't do so as a general solution.

ipython notebook save variables after closing

北慕城南 提交于 2019-12-23 17:17:08
问题 After you close the ipython notebook, I realized all the code is there but the namespace has been reset, as in all of the variables I had were gone. Is there a way I could save the variables so that when I turn ipython notebook back on, the variables are all there without rerunning the code? 回答1: Use the storemagic command. http://ipython.org/ipython-doc/rel-0.12/config/extensions/storemagic.html In [1]: l = ['hello',10,'world'] In [2]: %store l In [3]: exit (IPython session is closed and

ipython notebook save variables after closing

寵の児 提交于 2019-12-23 17:13:14
问题 After you close the ipython notebook, I realized all the code is there but the namespace has been reset, as in all of the variables I had were gone. Is there a way I could save the variables so that when I turn ipython notebook back on, the variables are all there without rerunning the code? 回答1: Use the storemagic command. http://ipython.org/ipython-doc/rel-0.12/config/extensions/storemagic.html In [1]: l = ['hello',10,'world'] In [2]: %store l In [3]: exit (IPython session is closed and

ipython startup config for spyder IDE

牧云@^-^@ 提交于 2019-12-23 16:27:40
问题 Trying to add a few imports to my IPython profile so that when I open a kernel in the Spyder IDE they're always loaded. Spyder has a Qt interface (I think??), so I (a) checked to make sure I was in the right directory for the profile using the ipython locate command in the terminal (OSX), and (b) placing the following code in my ipython_qtconsole_config.py file: c.IPythonQtConsoleApp.exec_lines = ["import pandas as pd", "pd.set_option('io.hdf.default_format', 'table')", "pd.set_option('mode

Access IPython's profile history (history.sqlite)

廉价感情. 提交于 2019-12-23 16:16:08
问题 When I restart IPython, I can access the input from my last session by pressing the up- and down-keys. I found that the history specific to a profile is saved in ~/.config/ipython/profile_profilename/history.sqlite . Is there a way to access this history in the same easy fashion as the %history command? The IPython reference describes the feature here: http://ipython.org/ipython-doc/dev/interactive/reference.html#readline-based-features This guy has the same question, but they don't find a

Custom Keybindings for Ipython terminal

ⅰ亾dé卋堺 提交于 2019-12-23 15:53:19
问题 Is it possible to define custom keybindings and/or desactivate the default ones for Ipython terminal interface? For example, I have bound C + j and C + l to move left and right in my terminal by configuring the ~/.inputrc file (Linux), but when using Ipython terminal, C + l is captured before and actually clears the screen. So my questions are: 1) Is it possible to desactivate some keybindings of Ipython 2) Even better, is it possible to totally configure Ipython keymap? 回答1: Reposting as an