ipython

why is there no reference between the app and the widget?

*爱你&永不变心* 提交于 2019-12-10 10:19:35
问题 This is a follow up to why will the application show after sys.exit command? I'm following this tutorial: http://zetcode.com/tutorials/pyqt4/firstprograms/ I modified the code slightly to test things import sys from PyQt4 import QtGui if __name__ == "__main__": app = QtGui.QApplication(sys.argv) w = QtGui.QWidget() w.resize(250,150) w.move(300,300) w.setWindowTitle("Title") w.show() sys.exit(app.exec_()) I'm confused as to why there isn't a reference of app and w i'd expect some kind of

Writing to PostgreSQL from pandas: AttributeError: 'Engine' object has no attribute 'cursor'

送分小仙女□ 提交于 2019-12-10 10:16:40
问题 I am trying to write a table to a PostgreSQL database from a Pandas data frame (following this answer) but I am getting the error AttributeError: 'Engine' object has no attribute 'cursor' My code is: import pandas as pd from sqlalchemy import create_engine import numpy as np df = pd.DataFrame(index=np.arange(1, 11), data=np.random.random(size=(10, 10)), columns=['c{}'.format(i) for i in np.arange(1, 11)]) engine = create_engine('postgresql://user@localhost:5432/db') df.to_sql('scores', engine

How to interrupt a runaway ipython evaluation without terminating the parent process?

ぐ巨炮叔叔 提交于 2019-12-10 10:15:14
问题 Sometimes it happens that an ongoing ipython evaluation won't respond to one, or even several, Ctrl-C 's from the keyboard 1 . Is there some other way to goose the ipython process to abort the current evaluation, and come back to its "read" state? Maybe with kill -SOMESECRETSIGNAL <pid> ? I've tried a few ( SIGINT , SIGTERM , SIGUSR1 , ...) to no avail: either they have no effect (e.g. SIGINT ), or they kill the ipython process. Or maybe some arcane ipython configuration? Some sentinel file?

Equivalent of Matlab “whos” command for Lua interpreter?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 10:14:12
问题 What is the Lua equivalent of the Octave/Matlab/IPython "whos" command? I'm trying to learn Lua interactively and would like to see what variables are currently defined. 回答1: All global variables in Lua reside in a table available as global variable _G (yes, _G._G == _G). Therefore if you want to list all global variable, you can iterate over the table using pairs() : function whos() for k,v in pairs(_G) do print(k, type(v), v) -- you can also do more sophisticated output here end end Note

Ipython 和 python 的区别

橙三吉。 提交于 2019-12-10 10:09:31
IPython是一个python交互shell,它比默认的python shell更易于使用。它支持自动变量完成、自动缩进、bash shell命令,并且内置了许多有用的函数和函数。 IPython是基于BSD的开源软件。 IPython为交互式计算提供了丰富的体系结构,包括: ·强大的交互式外壳 ·朱庇特核 ·交互式数据可视化工具 灵活可嵌入的解释器 ·易于使用的高性能并行计算工具 IPython的开发人员吸收了标准解释器的基本概念,并在此基础上进行了许多改进,创建了一个令人惊叹的工具。在其主页上,它说:“这是一个增强的交互式Python shell”,它具有选项卡完成、对象内省、强大的历史机制、嵌入式源代码编辑、集成Python调试器、%运行机制、宏、创建多个环境和调用系统shell等功能。 IPython和标准Python的最大区别是IPython对命令提示符的每一行进行编号。 Python shell和IPython的区别: Python外壳不能在退出时保存历史记录; IPython的历史记录自动保存在history.sqlite文件中,最后三条记录可以用“,”“和”“调用。 Python shell不支持tab自动完成; IPython支持选项卡完成。 Python shell不能快速获取类和函数信息; 通过“?”显示对象签名、文档字符串、代码位置,然后单击“?

数据分析

南楼画角 提交于 2019-12-10 10:08:34
文章目录 资源图 说明 下载链接 数据科学与计算 相关库 相关开发工具 Anaconda 下载与安装 虚拟环境 conda包管理器 Anaconda Navigator IPython 查看帮助 命令补全 魔法命令 who whos time timeit automagic history writefile(file) prun lprun memit mprun 单元格 命令模式与编辑模式 常用快捷键 命令模式 编辑模式 通用模式 Markdown 标题 无序列表 有序列表 LaTex spyder 资源图 说明 第一节看博客 后面的全发链接了 下载链接 地址 https://pan.baidu.com/s/1sH2_yKAGw6owg0qitVZVFA 数据科学与计算 相关库 numpy matplotlib pandas 相关开发工具 PyCharm Anaconda IPython Jupyter notebook Spyder 说明: IPython,Jupyter notebook与Spyder已集成在Anaconda中。 选择哪一款开发工具,取决于个人的偏好。 Anaconda Anaconda是Python的一个免费发行版本,适合在数据科学与机器学习领域的开发。其集成了Python解释器,同时也包含很多数据科学计算的软件包与开发工具。Anaconda具有两个版本

How can I spawn an IPython qtconsole within my app while passing existing objects to that console

杀马特。学长 韩版系。学妹 提交于 2019-12-10 09:34:39
问题 I am trying to embed an IPython qtconsole in my application, in a similar way that I can embed an IPython text console, thus: from IPython.frontend.terminal.embed import InteractiveShellEmbed myobj={'jason':10} shell = InteractiveShellEmbed() shell.user_ns = myobj shell() I can start a QT console in my application by using from IPython.frontend.qt.console.qtconsoleapp import IPythonQtConsoleApp app = IPythonQtConsoleApp() app.initialize() app.start() But this has no access to existing objects

iPython - set up magic commands in configuration file

守給你的承諾、 提交于 2019-12-10 03:19:29
问题 I use iPython mostly via notebooks but also in the terminal. I just created my default profile by running ipython profile create . I can't seem to figure out how to have the profile run several magic commands that I use every time. I tried to look this up online and in a book I'm reading but can't get it to work. For example, if I want %debug activated for every new notebook I tried adding these lines to my config file: c.InteractiveShellApp.extensions = ['debug'] or c.TerminalPythonApp

Running doctests through iPython and pseudo-consoles

拈花ヽ惹草 提交于 2019-12-09 21:44:18
问题 I've got a fairly basic doctestable file: class Foo(): """ >>> 3+2 5 """ if __name__ in ("__main__", "__console__"): import doctest doctest.testmod(verbose=True) which works as expected when run directly through python. However, in iPython, I get 1 items had no tests: __main__ 0 tests in 1 items. 0 passed and 0 failed. Test passed. Since this is part of a Django project and will need access to all of the appropriate variables and such that manage.py sets up, I can also run it through a

Connecting to a Windows IPython kernel from Linux

你离开我真会死。 提交于 2019-12-09 19:57:43
问题 I have a Windows machine where I start an IPython kernel (to do some stuff not possible on another machine). I have a Linux machine from which I would like to connect to the IPython kernel running on the Windows machine. I can SSH from the Linux machine to the Windows machine (using this solution: https://superuser.com/a/172299). I have tried following: https://github.com/ipython/ipython/wiki/Cookbook:-Connecting-to-a-remote-kernel-via-ssh. Both the automatic and the manual solution gives the