文章分类 -  python

摘要:import time TOTAL_OK = 5 ERRER_LEVEL = 1 COLUMN_EVERY_LINE = 16 COLUMN = 16 lineList = [] def test(): lineNumber = 0 previous = [-2 for i in range(COLUMN_EVERY_LINE)] total = [0 f... 阅读全文
posted @ 2019-07-18 15:49 牧 天 阅读(468) 评论(0) 推荐(0) 编辑
摘要:import time import threading errerLevel = 1 TOTAL_OK = 24 lineList = [] threadLock = threading.Lock() threads = [] class myThread (threading.Thread): def __init__(self, index): threa... 阅读全文
posted @ 2019-07-18 14:00 牧 天 阅读(179) 评论(0) 推荐(0) 编辑
摘要:test.csv (4, 3) name age score0 caoming 1 1001 muhe 2 992 muhe221 3 93 muhe221 3 1 age scorename caoming 1 100muhe 2 99muhe221 6 10<class 'pandas.core 阅读全文
posted @ 2019-05-20 11:33 牧 天 阅读(251) 评论(0) 推荐(0) 编辑
摘要:d:/train.csv (7, 12) datetime season holiday workingday weather temp atemp humidity windspeed casual registered count0 2011-01-01 00:00:00 1 0 0 1 9.8 阅读全文
posted @ 2019-05-19 08:41 牧 天 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Seaborn其实是在matplotlib的基础上进行了更高级的API封装,从而使得作图更加容易,在大多数情况下使用seaborn就能做出很具有吸引力的图,而使用matplotlib就能制作具有更多特色的图。应该把Seaborn视为matplotlib的补充,而不是替代物。 https://www. 阅读全文
posted @ 2019-05-19 08:36 牧 天 阅读(161) 评论(0) 推荐(0) 编辑
摘要:a b cbj 0 1 2sh 3 4 5gz 6 7 8Index(['bj', 'sh', 'gz'], dtype='object') a b cbeijing 0 1 2shanghai 3 4 5guangzhou 6 7 8 A B CBEIJING 0 1 2SHANGHAI 3 4 阅读全文
posted @ 2019-05-19 08:28 牧 天 阅读(383) 评论(0) 推荐(0) 编辑
摘要:A B C D 0 A0 B0 C0 D01 A1 B1 C1 D12 A2 B2 C2 D23 A3 B3 C3 D3 B C DA A0 B0 C0 D0A1 B1 C1 D1A2 B2 C2 D2A3 B3 C3 D3 A B C DA A0 A0 B0 C0 D0A1 A1 B1 C1 D1 阅读全文
posted @ 2019-05-18 14:16 牧 天 阅读(4894) 评论(0) 推荐(0) 编辑
摘要:import matplotlib.pyplot as plt import numpy as np def y_subplot(x,i): return np.cos(i * np.pi *x) x = np.linspace(1, 100, num= 25, endpoint = True) #使用subplots 画图 f, ax = plt.subplots(2,2) #... 阅读全文
posted @ 2019-05-16 09:25 牧 天 阅读(177) 评论(0) 推荐(0) 编辑
摘要:import argparse parser = argparse.ArgumentParser() #parser = argparse.ArgumentParser(prog='It\'s a cool job!', usage='U can use it', description='It\'s description', epilog='It\'s EPILOG') pa... 阅读全文
posted @ 2019-04-16 19:55 牧 天 阅读(89) 评论(0) 推荐(0) 编辑
摘要:MainThread 13388text:text2ThreadPoolExecutor-0_0 97922019-02-01 20:09:47text:text1ThreadPoolExecutor-0_1 5362019-02-01 20:09:47text:text3ThreadPoolExe 阅读全文
posted @ 2019-02-01 20:11 牧 天 阅读(768) 评论(0) 推荐(0) 编辑
摘要:The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, 阅读全文
posted @ 2019-01-29 10:16 牧 天 阅读(148) 评论(0) 推荐(0) 编辑
摘要:scrapy.Item可以将数据以json的形式存储起来为了定义常用的输出数据,Scrapy提供了Item 类。 Item 对象是种简单的容器,保存了爬取到得数据。 其提供了 类似于词典(dictionary-like) 的API以及用于声明可用字段的简单语法。 scrapy startprojec 阅读全文
posted @ 2019-01-26 16:48 牧 天 阅读(197) 评论(0) 推荐(0) 编辑
摘要:pyinstaller是一个python打包工具,生成一个可执行文件 举例 需要打包的源文件 生成可执行文件mytest.exe 双击即可执行(在其它电脑上也可以执行) 阅读全文
posted @ 2019-01-25 16:40 牧 天 阅读(251) 评论(0) 推荐(0) 编辑
摘要:Scrapy提供了两种类型的命令。一种必须在Scrapy项目中运行(针对项目(Project-specific)的命令),另外一种则不需要(全局命令)。全局命令在项目中运行时的表现可能会与在非项目中运行有些许差别(因为可能会使用项目的设定)。 全局命令:startproject settings r 阅读全文
posted @ 2019-01-25 15:38 牧 天 阅读(146) 评论(0) 推荐(0) 编辑
摘要:scrapy提取数据的方式除了css选择器之外还有xpath提取方式。技多不压身。xpath表达式函数:response.xpath("表达式")每个.xpath() 调用返回selector组成的list windows设置代理:set http_proxy=http://username:pas 阅读全文
posted @ 2019-01-25 15:02 牧 天 阅读(514) 评论(0) 推荐(0) 编辑
摘要:2开头的http状态码 表示请求成功200 成功处理了请求,一般情况下都是返回此状态码 4开头的http状态码表示请求出错400 请求出错 由于语法格式有误,服务器无法理解此请求。不作修改,客户程序就无法重复此请求。 401 请求要求身份验证。407 此状态代码与401类似,但指定请求者应当授权使用 阅读全文
posted @ 2019-01-25 11:13 牧 天 阅读(132) 评论(0) 推荐(0) 编辑
摘要:URL有两种写法,一种作为类的常量、一种作为start_requests(self)方法的常量.无论哪一种写法,URL都是必须的.如果URL是定义在start_request(self)这个方法里面,那我们就要使用: yield scrapy.Request 方法发送请求 1. URL作为类的常量 阅读全文
posted @ 2019-01-24 19:49 牧 天 阅读(419) 评论(0) 推荐(0) 编辑
摘要:Scrapy有2种方式配置代理1.代码实现2.通过修改配置文件 1.代码实现 2.通过配置文件实现 <1、爬取代码 D:\work\pycode>scrapy startproject tutorial <2、设置代理 这里使用自动生成的代理中间件,修改settings.py,将这三行打开 表示使用 阅读全文
posted @ 2019-01-24 17:33 牧 天 编辑
摘要:这里介绍爬取下一页 爬取的内容为: 网页源码中下一页的链接如下: 爬取多页的源码: 参考网址:http://www.scrapyd.cn/doc/160.html scrapy arguments:指定蜘蛛参数爬取 比如我们要爬取标签:爱情,我们可以这样:scrapy crawl argsSpide 阅读全文
posted @ 2019-01-24 11:24 牧 天 阅读(1539) 评论(0) 推荐(0) 编辑
摘要:平台:windows + Python3.6.8pip install scrapypip install incremental (如果缺少该库则安装该库) 错误信息:building 'twisted.test.raiser' extensionerror: Microsoft Visual C 阅读全文
posted @ 2019-01-23 15:31 牧 天 阅读(178) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示