ipython

Django IPython sqlite complains about naive datetime

巧了我就是萌 提交于 2019-12-31 12:41:46
问题 I have a new project in Django 1.4, using sqlite db. Also using django_extenstions' shell_plus with no problems. When I installed IPython, both shell and shell_plus started to complain about: /path/to/my/virtualenv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py:50: RuntimeWarning: SQLite received a naive datetime (2012-07-29 13:15:45.229464) while time zone support is active. It seems IPython itself uses unaware datetimes. How can this be fixed? EDIT: I don't want to disable

IPython/Jupyter Problems saving notebook as PDF

醉酒当歌 提交于 2019-12-31 08:08:09
问题 So, i've been trying to save a jupyter notebook as PDF but i just can't figure out how to do this. The first thing i try is from the file menu just download as PDF, but doing that results in: nbconvert failed: PDF creating failed the next thing i try is try to do the conversion from the Command Prompt like this $ ipython nbconvert --to latex --post PDF MyNotebook.ipynb but again, this results in an error message ImportError: No module named 'PDF' and if i try $ ipython nbconvert --to latex

IPython/Jupyter Problems saving notebook as PDF

牧云@^-^@ 提交于 2019-12-31 08:08:09
问题 So, i've been trying to save a jupyter notebook as PDF but i just can't figure out how to do this. The first thing i try is from the file menu just download as PDF, but doing that results in: nbconvert failed: PDF creating failed the next thing i try is try to do the conversion from the Command Prompt like this $ ipython nbconvert --to latex --post PDF MyNotebook.ipynb but again, this results in an error message ImportError: No module named 'PDF' and if i try $ ipython nbconvert --to latex

Why does import pdb; pdb.set_trace trigger two different debugging scenarios when called differently in Spyder?

蓝咒 提交于 2019-12-31 07:01:11
问题 This is a follow-up question to Stepwise debugging of selected Python code. Why does import pdb; pdb.set_trace trigger two different debugging scenarios when called differently in Spyder? Here's the edited sample code in the answer from Carlos Cordoba to the question mentioned above. The code: def foo(): names = ['A', 'B', 'C'] values = [11,12,13] i = 0 import pdb; pdb.set_trace() for n in names: variable = str(n) + ' = ' + str(values[i]) print(variable) i += 1 foo() Scenario1 - Run file (F5)

Jupyter Notebook: Output image in previous line

岁酱吖の 提交于 2019-12-31 05:12:10
问题 I want to plot some image side by side in my jupyter notebook. So it can save some space for display. For example This is done through fig = plt.figure(figsize=(14,3)) ax1 = fig.add_subplot(1,3,1,projection = '3d') ax2 = fig.add_subplot(1,3,2) ax3 = fig.add_subplot(1,3,3) And this makes them in one .png file. However, later on in writing the paper, I may only want part of the image. For example, the 2nd or the 3rd in previous plot. And this requires me to crop the image manually . One way I

replace function with dictionary

半世苍凉 提交于 2019-12-31 05:10:23
问题 I want to build a dictionary or something for the replace function to look up and replace each string throughout an entire column respectively. For example if the replace function finds the characters 'Drive', 'Dr', 'DRIVE', or 'Dr.', I would like all of those to be replaced by 'DR' and all the other street endings. current Address '123 Alabama Drive', '12 Florida Str', '10 10th Dr.' replaced with '123 ALABAMA DR', '12 FLORIDA ST', '10 10TH DR' 回答1: See this function for starting point. As

Python Pandas Create Multiple dataframes from list

回眸只為那壹抹淺笑 提交于 2019-12-31 04:04:07
问题 Using this as a quick starting point; http://pandas.pydata.org/pandas-docs/stable/reshaping.html In [1]: df Out[1]: date variable value 0 2000-01-03 A 0.469112 1 2000-01-04 A -0.282863 2 2000-01-05 A -1.509059 3 2000-01-03 B -1.135632 4 2000-01-04 B 1.212112 5 2000-01-05 B -0.173215 6 2000-01-03 C 0.119209 7 2000-01-04 C -1.044236 8 2000-01-05 C -0.861849 9 2000-01-03 D -2.104569 10 2000-01-04 D -0.494929 11 2000-01-05 D 1.071804 Then isolating 'A' gives this: In [2]: df[df['variable'] == 'A'

How to setup ssh tunnel for ipython cluster (ipcluster)

[亡魂溺海] 提交于 2019-12-31 03:53:04
问题 I would like to run an ipython cluster on a ssh-accessible server and on some other machines all of which can connect to each other via ssh. The network is not trusted. I have tried setting up ssh tunneling using what I understood from the documentation on ipcontroller and ipengine. However the only way that I ended up getting a communication working is by implementing the tunnels manually. Using the instruction from Jean-Francis Roy one would first fix all the necessary ports controller-host

转:Win10下用Anaconda安装TensorFlow

妖精的绣舞 提交于 2019-12-31 01:33:19
转自:https://www.cnblogs.com/afangxin/p/6992050.html 笔者之前在学习TensorFlow,也在自己的笔记本上完成了安装,在PyCharm中进行学习。但是最近为了使用 Python 的科学计算环境,我把之前的环境卸载了,并用Anaconda重新安装了TensorFlow,这里介绍一下cpu版本的安装方法。 前提检查: 在 https://developer.nvidia.com/cuda-gpus 确认你的显卡支持 CUDA,如果你安装的是gpu版本的tensorflow才需要检查这一步。 确保你的Python版本是3.5 64位。 确保你有稳定的网络连接。 确保你的pip版本 >= 8.1。用 pip -V 查看当前 pip 版本,用 python -m pip install -U pip 升级 pip 。 确保你安装了 VS2015 或者 2013 或者 2010。此条非必须,删除。 1.安装Anaconda 选择相应的Anaconda进行安装,下载地址:https://www.continuum.io/downloads/,下载对应系统版本的Anaconda,官网现在的版本是Anaconda 4.4.0 for python3.6。笔者安装的是4.4.0版本的。 就和安装普通的软件一样,全部选择默认即可,注意

搭建Jupyter Notebook服务器

こ雲淡風輕ζ 提交于 2019-12-31 01:28:07
昨天发了Jupyter的使用,补一篇Jupyter服务器的搭建~ 一、搭建Jupyter 1.安装 使用virtualenv建虚拟环境。在虚拟环境中安装jupyter、matplotlib等等需要的库。这里不赘述了。 2.配置 为Jupyter 相关文件准备一个目录 mkdir /data/jupyter cd /data/jupyter 建立一个目录作为 Jupyter 运行的根目录 mkdir /data/jupyter/root 我们以需要密码验证的模式启动 Jupyter,所以要预先生成所需的密码对应的密文。 使用下面的命令创建一个密文的密码 python2 python -c "import IPython;print IPython.lib.passwd()" python3 python -c "import IPython;print(IPython.lib.passwd())" 执行后需要输入并确认密码,然后程序会返回一个 'sha1:...' 的密文,留好了,我们接下来将会用到它。 查看用户目录 ~/.jupyter 路径下是否存jupyter_notebook_config.py 文件。若不存在,产生此文件。 jupyter notebook --generate-config 编辑此文件,在最后写入 c.NotebookApp.ip = '*' #