Python学习笔记
文章平均质量分 58
神棍来也
这个作者很懒,什么都没留下…
展开
-
线程队列排序(双向队列)
利用 .append 和 .pop 方法,我们可以把列表当作栈或者队列来用(比如,把 .append 和 .pop(0) 合起来用,就能模拟栈的“先进先出”的特点)。但是删除列表的第一个元素(抑或是在第一个元素之前添加一个元素)之类的操作是很耗时的,因为这些操作会牵扯到移动列表里的所有元素。 collections.deque 类(双向队列)是一个线程安全、可以快速从两...转载 2018-11-12 20:37:19 · 513 阅读 · 0 评论 -
Matplotlib-柱状图-bar
import matplotlib.pyplot as plt x = ['Q1','Q2','Q3','Q4'] y = [10,30,20,60] plt.bar(x,y) plt.show() 改变颜色,使用color x = ['Q1','Q2','Q3','Q4'] y = [10,30,20,60] ...转载 2018-11-27 01:32:29 · 418 阅读 · 0 评论 -
Matplotlib-折线图-plot
>>> import matplotlib.pyplot as plt >>> import numpy as np >>> #折线图 >>> x = np.arange(10) >>> np.random.seed(1) >>>转载 2018-11-27 01:31:32 · 254 阅读 · 0 评论 -
Matplotlib-散点图-scatter
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> import matplotlib.pypl...转载 2018-11-27 01:29:29 · 207 阅读 · 0 评论 -
Pandas绘图
载入数据 sep制定分隔符 折线图 设置城市为索引 绘制直方图 坐标出现乱码问题 在前面设置字体 箱线图 直方图 多组数据 横向 堆叠 保存图片 ...转载 2018-11-27 01:24:48 · 113 阅读 · 0 评论 -
Pandas时间序列
import time time.time() 1542903985.5287802 time.localtime(1542903985)#将时间戳转化为时间对象 time.struct_time(tm_year=2018, tm_mon=11, tm_mday=23, tm_hour=0, tm_min=26, tm_sec=25, tm_wday=4, tm_yday=327, ...转载 2018-11-27 01:20:11 · 223 阅读 · 0 评论 -
Pandas数据汇总
import numpy as np import pandas as pd data = [[1,None],[4,5][None,None],[8,9],[3,4]] Traceback (most recent call last): File “<pyshell#2>”, line 1, in data = [[1,None],[4,5][None,None],[8,9...转载 2018-11-27 01:19:05 · 320 阅读 · 0 评论 -
Pandas排序与合并
import pandas as pd 排序-sort ser = pd.Series(list(“CAB”),index=[2,1,3]) ser 2 C 1 A 3 B dtype: object ser.sort_index() 1 A 2 C 3 B dtype: object ser.sort_index(ascending=Fa...转载 2018-11-27 01:18:05 · 4947 阅读 · 0 评论 -
Python自动化运维
重点: SSH免密码登录 使用Ansible批量下发或收集文件 使用Paramiko批量监控 SSH免密码登录 使用RSA非对称机密算法 Public Key 公钥 Private Key 私钥 命令: ssh-keygen 生成密钥,公钥和私钥 ssh-copy-id 将公钥放入服务器 例子: 验证: Ansible 配置机器列表 /etc/ansible/hos...原创 2018-11-12 23:25:52 · 3283 阅读 · 0 评论 -
Linux基础命令
Linux 1 linux基础命令 打印当前目录 pwd print working directory cd 切换目录 change directory cd 宿主目录 cd – 上次的目录 cd … 上级目录 列出目录文件 ls ls –a 显示隐藏文件 ls –l 详细信息 ls –F 在目录后加斜线 ls –h 显示文件大小 移动和重命名 mv 文件名 目录 mv 目录/文件名 目录/...原创 2018-11-12 21:55:24 · 131 阅读 · 0 评论 -
Pyenv使用说明
Linux安装 yum -y install git yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel 安装完后可创建用户 useradd python 使用python登陆,执行下载回一个脚本 [root@ansible...原创 2018-12-05 22:36:31 · 457 阅读 · 0 评论