ipython

5个酷毙的Python神器工具

£可爱£侵袭症+ 提交于 2021-01-20 01:54:21
点击上方“ 跟我学Python ”,选择“星标”公众号 重磅干货,第一时间送达 来源:Python之禅 工欲善其事必先利其器,一个好的工具能让起到事半功倍的效果,Python社区提供了足够多的优秀工具来帮助开发者更方便的实现某些想法,下面这几个工具给我的工作也带来了很多便利,推荐给追求美好事物的你。 Python Tutor Python Tutor 是由 Philip Guo 开发的一个免费教育工具,可帮助学生攻克编程学习中的基础障碍,理解每一行源代码在程序执行时在计算机中的过程。通过这个工具,教师或学生可以直接在 Web 浏览器中编写 Python 代码,并逐步可视化地运行程序。如果你不知道代码在内存中是如何运行的,不妨把它拷贝到Tutor里可视化执行一遍,加深理解。 地址:http://www.pythontutor.com/ IPython IPython 是一个 for Humans 的 Python 交互式 shell,用了它之后你就不想再用自带的 Python shell 了,IPython 支持变量自动补全,自动缩进,支持 bash shell 命令,内置了许多实用功能和函数,同时它也是科学计算和交互可视化的最佳平台。回复 “ipython” 获取《IPython交互式编程和数据可视化 教程 》。 地址:https://ipython.org/ Jupyter

Python开发必备的5个酷毙的Python工具

白昼怎懂夜的黑 提交于 2021-01-19 10:11:56
文 | 刘志军 来源 | Python之禅 工欲善其事必先利其器,一个好的工具能让起到事半功倍的效果,Python 社区提供了足够多的优秀工具来帮助开发者更方便的实现某些想法,下面这几个工具给我的工作也带来了很多便利,推荐给追求美好事物的你。 Python Tutor Python Tutor 是由 Philip Guo 开发的一个免费教育工具,可帮助学生攻克编程学习中的基础障碍,理解每一行源代码在程序执行时在计算机中的过程。通过这个工具,教师或学生可以直接在 Web 浏览器中编写 Python 代码,并逐步可视化地运行程序。如果你不知道代码在内存中是如何运行的,不妨把它拷贝到Tutor里可视化执行一遍,加深理解。 地址:http://www.pythontutor.com/ IPython IPython 是一个 for Humans 的 Python 交互式 shell,用了它之后你就不想再用自带的 Python shell 了,IPython 支持变量自动补全,自动缩进,支持 bash shell 命令,内置了许多实用功能和函数,同时它也是科学计算和交互可视化的最佳平台。回复 “ipython” 获取《IPython交互式编程和数据可视化教程》。 地址:https://ipython.org/ Jupyter Notebook Jupyter Notebook 就像一个草稿本

6-MySQL高级-索引

拜拜、爱过 提交于 2021-01-19 07:12:30
索引 1. 思考 在图书馆中是如何找到一本书的? 一般的应用系统对比数据库的读写比例在10:1左右(即有10次查询操作时有1次写的操作), 而且插入操作和更新操作很少出现性能问题, 遇到最多、最容易出问题还是一些复杂的查询操作,所以查询语句的优化显然是重中之重 2. 解决办法 当数据库中数据量很大时,查找数据会变得很慢 优化方案:索引 3. 索引是什么 索引是一种特殊的文件(InnoDB数据表上的索引是表空间的一个组成部分),它们包含着对数据表里所有记录的引用指针。 更通俗的说,数据库索引好比是一本书前面的目录,能加快数据库的查询速度 4. 索引目的 索引的目的在于提高查询效率 ,可以类比字典,如果要查“mysql”这个单词,我们肯定需要定位到m字母,然后从下往下找到y字母,再找到剩下的sql。如果没有索引,那么你可能需要把所有单词看一遍才能找到你想要的,如果我想找到m开头的单词呢?或者ze开头的单词呢?是不是觉得如果没有索引,这个事情根本无法完成? 5. 索引原理 除了词典,生活中随处可见索引的例子,如火车站的车次表、图书的目录等。它们的原理都是一样的,通过不断的缩小想要获得数据的范围来筛选出最终想要的结果,同时把随机的事件变成顺序的事件,也就是我们总是通过同一种查找方式来锁定数据。 数据库也是一样,但显然要复杂许多,因为不仅面临着 等值查询,还有范围查询(>、<、between

How to plot a bar graph from a pandas series?

冷暖自知 提交于 2021-01-17 17:37:17
问题 Consider my series as below: First column is article_id and the second column is frequency count. article_id 1 39 2 49 3 187 4 159 5 158 ... 16947 14 16948 7 16976 2 16977 1 16978 1 16980 1 Name: article_id, dtype: int64 I got this series from a dataframe with the following command: logs.loc[logs['article_id'] <= 17029].groupby('article_id')['article_id'].count() logs is the dataframe here and article_id is one of the columns in it. How do I plot a bar chart(using Matlplotlib) such that the

How to plot a bar graph from a pandas series?

允我心安 提交于 2021-01-17 17:34:14
问题 Consider my series as below: First column is article_id and the second column is frequency count. article_id 1 39 2 49 3 187 4 159 5 158 ... 16947 14 16948 7 16976 2 16977 1 16978 1 16980 1 Name: article_id, dtype: int64 I got this series from a dataframe with the following command: logs.loc[logs['article_id'] <= 17029].groupby('article_id')['article_id'].count() logs is the dataframe here and article_id is one of the columns in it. How do I plot a bar chart(using Matlplotlib) such that the

How to plot a bar graph from a pandas series?

拟墨画扇 提交于 2021-01-17 17:33:06
问题 Consider my series as below: First column is article_id and the second column is frequency count. article_id 1 39 2 49 3 187 4 159 5 158 ... 16947 14 16948 7 16976 2 16977 1 16978 1 16980 1 Name: article_id, dtype: int64 I got this series from a dataframe with the following command: logs.loc[logs['article_id'] <= 17029].groupby('article_id')['article_id'].count() logs is the dataframe here and article_id is one of the columns in it. How do I plot a bar chart(using Matlplotlib) such that the

How to show PIL Image in ipython notebook

谁说胖子不能爱 提交于 2021-01-16 04:39:29
问题 This is my code from PIL import Image pil_im = Image.open('data/empire.jpg') I would like to do some image manipulation on it, and then show it on screen. I am having problem with showing PIL Image in python notebook. I have tried: print pil_im And just pil_im But both just give me: <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=569x800 at 0x10ECA0710> 回答1: You can use IPython's Module: display to load the image. You can read more from the Doc. from IPython.display import Image pil

JupyterLab安装与配置虚拟环境

走远了吗. 提交于 2021-01-14 07:57:04
JupyterLab安装:   推荐使用miniconda,相比于anaconda更加简洁,下载连接: https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/ 安装 pip install jupyterlab 配置启动目录 jupyter notebook --generate-config 会生产一个配置文件 默认路径C:\Users\用户名\.jupyter\jupyter_notebook_config.py 修改其中的几个配置项 并取消前面的注释 ipython In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:f704b702aea2:01e2bd991f9c7208ba177b46f4d10b6907810927' # 配置启动目录 c.NotebookApp.notebook_dir = 'E :/Projects ' # 配置chrom的本地启动功能,让lab像IDE一样在本地打开 c.NotebookApp.browser = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe

(一)Python入门:03开发环境介绍-交互模式的使用-IDLE介绍和使用

99封情书 提交于 2021-01-14 04:09:04
一:Python开发环境   开发环境,英文是 IDE(Integrated Development Environment 集成开发环境)。   不要纠结于使用哪个开发环境。开发环境本质上就是对 Python解释器 python.exe 的 封装,核心都一样。可以说:“开发环境IDE,只是解释器的一个外挂而已”,只是为了让 程序员更加方便编程,减少出错率,尤其是拼写错误。   常用的开发环境: IDLE   Pycharm wingIDE Eclipse IPython 二:交互模式(脚本Shell模式) 进入cmd命令窗口,输入python,回车 >>> 此符号为提示符 关闭交互窗口: (1)Ctrl+Z和回车 (2)输入quit()命令 (3)直接关闭命令行窗口 中断程序执行: Ctrl+C   交互模式工作原理和Python处理文件的方式一样。除了一点:当你输入一些值时,交 互模式会自动打印输出。Py 文件中则必须使用 print 语句。 三:IDLE开发环境介绍 IDLE是Python的官方标准开发环境,Python安装完后同时就安装了 IDLE。 IDLE已经具备了 Python开发几乎所有功能(语法智能提示、不同颜色显示不同类型等),也不需要其他配置,非常适合初学者使用。 IDLE是Python 标准发行版内置的一个简单小巧的IDE,包括了交互式命令行、编辑器、

show origin axis (x,y) in matplotlib plot

你。 提交于 2021-01-13 14:03:46
问题 I have following simple plot, and I would like to display the origin axis (x, y). I already have grid, but I need the x, y axis to be emphasized. this is my code: x = linspace(0.2,10,100) plot(x, 1/x) plot(x, log(x)) axis('equal') grid() I have seen this question. The accepted answer suggests to use "Axis spine" and just links to some example. The example is however too complicated, using subplots. I am unable to figure out, how to use "Axis spine" in my simple example. 回答1: Using subplots is