ipython

Difference in GLM results between iPython and R

强颜欢笑 提交于 2019-12-21 18:07:46
问题 I'm trying to get to grips with performing regression analyses in R. Below is some random dummy data that I have generated in R, run a logistic glm in R. I have saved the data into a test file, read that into python with ipython (ipython notebook is awesome btw, only just started using it!), and then tried to run the same analyis with python. The results are very similar but they are different. I kind of would have expected them to be the same. Have I done something wrong, is there a

Exporting Interactive Jupyter Notebook to html

半世苍凉 提交于 2019-12-21 15:39:14
问题 The following code plots an interactive figure where I can toggle specific lines on/off. This works perfectly when I'm working in an Ipython Notebook import pandas as pd import numpy as np from itertools import cycle import matplotlib.pyplot as plt, mpld3 from matplotlib.widgets import CheckButtons import matplotlib.patches import seaborn as sns %matplotlib nbagg sns.set(style="whitegrid") df = pd.DataFrame({'freq': {0: 0.01, 1: 0.02, 2: 0.029999999999999999, 3: 0.040000000000000001, 4: 0

IPython auto-completion emacs24 doesn't work

守給你的承諾、 提交于 2019-12-21 14:17:09
问题 I'm using emacs24.0.92 with IPython 12. I took ipython.el file from IPython repository and also tried this patch however auto-completion still does not work for me. Can someone give any hint about it ? 回答1: That's an old question but since I was looking for it: 1- python-mode.el A quick search lead me to this working solution: http://www.emacswiki.org/emacs/PythonProgrammingInEmacs#toc5 2- jedi You still can use the completion given by jedi.el : http://jedi.jedidjah.ch/en/latest/ http:/

Kernel Error in R Notebook using Jupyter Notebook

不羁的心 提交于 2019-12-21 12:40:03
问题 I am trying to use R within the jupyter notebook. I went to my R shell and ran install.packages(c('rzmq','repr','IRkernel','IRdisplay'), repos = c('http://irkernel.github.io/', getOption('repos'))) IRkernel::installspec() Then I loaded up my ipython notebook and created a new notebook using the now available R extension. How ever when I access the notebook I run into this kernal error: Traceback (most recent call last): File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\base

Python decorator to keep signature and user defined attribute

◇◆丶佛笑我妖孽 提交于 2019-12-21 10:18:26
问题 I have my simple decorator my_decorator which decorates the my_func . def my_decorator(func): def wrapper(*args, **kwargs): return func(*args, **kwargs) wrapper._decorator_name_ = 'my_decorator' return wrapper @my_decorator def my_func(x): print('hello %s'%x) my_func._decorator_name_ 'my_decorator' Till here things work, but I can't see the actual signature of the function. my_func? Signature: my_func(*args, **kwargs) Docstring: <no docstring> File: ~/<ipython-input-2-e4c91999ef66> Type:

Visual studio code interactive python console

心不动则不痛 提交于 2019-12-21 07:13:10
问题 I'm using visual studio code with DonJayamanne python extension. It's working fine but I want to have an interactive session just like the one in Matlab, where after code execution every definition and computational result remains and accessible in the console. For example after running this code: a = 1 the python session is terminated and I cannot type in the console something like: b = a + 1 print(b) I'm aware that the python session can stay alive with a "-i" flag. But this simply doesn't

How can I recreate the effect of IPython's '--pylab' option with a script?

好久不见. 提交于 2019-12-21 05:43:22
问题 I'd like to create a profile that does the same thing as IPython's --pylab flag "by hand". What should the contents of a script be — package imports, namespace designations, settings, etc. — to achieve this? As an alternative, I'd also be interested in whether there is a way to check that the --pylab flag was set when the current IPython session was launched. Simply doing from matplotlib.pylab import * doesn't work, nor does %pylab (since magics don't seem to be allowed in profiles). 回答1:

Reading large text files with Pandas [duplicate]

孤者浪人 提交于 2019-12-21 05:07:09
问题 This question already has answers here : How to read a 6 GB csv file with pandas (13 answers) Closed last year . I have been trying to read a few large text files (sizes around 1.4GB - 2GB) with Pandas, using the read_csv function, with no avail. Below are the versions I am using: Python 2.7.6 Anaconda 1.9.2 (64-bit) (default, Nov 11 2013, 10:49:15) [MSC v.1500 64 bit (AMD64)] IPython 1.1.0 Pandas 0.13.1 I tried the following: df = pd.read_csv(data.txt') and it crashed Ipython with a message:

How to remove password for Jupyter Notebooks and set token again

老子叫甜甜 提交于 2019-12-21 03:42:55
问题 I need to do this for Pycharm. Here are the steps that I did which I'm not able to undo. I added a password for authentication using: $ jupyter notebook password I then used the below command to comment all the code in jupyter_notebook_config.py $ jupyter notebook --generate-config Then I removed the hashed password generated in the jupyter_notebook_config.json which now looks like this { "NotebookApp": { "password": "" } } I then did the following changes in jupyter_notebook_config.py file c

notify when execution/command is completed

旧巷老猫 提交于 2019-12-21 03:41:09
问题 How do I get IPython to notify me when a command has been executed? Can I get it to use the bell/alert, or by pop-up? I'm running Anaconda on iTerm on OS X 10.8.5. 回答1: With the newest version of iTerm, you can use the alert on next mark functionality of the shell integration. 回答2: Finally someone created a nice library for it. You just install it: pip install jupyternotify Import it in your notebook: import jupyternotify ip = get_ipython() ip.register_magics(jupyternotify.JupyterNotifyMagics