摘要: 1.用Hive对爬虫大作业产生的文本文件(或者英文词频统计下载的英文长篇小说)进行词频统计。 解析:因为上一次我的大作业是对电影的爬取,爬出来的文档有些是英语也有些是中文,又因为生成的文档是中文甚至过于庞大,所以这一次的大作业我就下载了几个《简爱》英语版小说的几个章节,文档也是足够大了,有的文档内容 阅读全文
posted @ 2018-05-20 09:48 248黄迎迎 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 1.启动hadoop start-all.sh 2.Hdfs上创建文件夹 hdfs dfs -mkdir wcinput hdfs dfs -ls /user/hadoop 3.上传文件至hdfs hdfs dfs -put ./509.txt wcinput hdfs dfs -ls /user/ 阅读全文
posted @ 2018-05-15 17:55 248黄迎迎 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 1.编写map函数,reduce函数 (1)创建mapper.py文件 cd /home/hadoop/wc gedit mapper.p (2)mapper函数 cd /home/hadoop/wc gedit reducer.py 放到HDFS上运行 下载并上传文件到hdfs上 阅读全文
posted @ 2018-05-10 13:58 248黄迎迎 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 1.以下关系型数据库中的表和数据,要求将其转换为适合于HBase存储的表并插入数据: 学生表(Student)(不包括最后一列) put 'Student','188','S_No','2015001' put 'Student','190','S_No','2015003' put 'Studen 阅读全文
posted @ 2018-05-08 17:00 248黄迎迎 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 一. 1/在本地Linux文件系统的“/home/hadoop/”目录下创建一个文件txt,里面可以随意输入一些单词. cd /usr/local/hadoop 2.在本地查看文件位置(ls) touch test.txt 3.在本地显示文件内容 cat test.txt 4.使用命令把本地文件系统中的“txt”上传到HDFS中的当前用户目录的input目录下 ./sbi... 阅读全文
posted @ 2018-04-26 10:39 248黄迎迎 阅读(151) 评论(0) 推荐(0) 编辑
摘要: def getWordColod(wc): image = Image.open('./movie.png') graph = np.array(image) font = r'C:\Windows\Fonts\simhei.TTF' wc = WordCloud(font_path=font, b 阅读全文
posted @ 2018-04-21 00:46 248黄迎迎 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 1. 将新闻的正文内容保存到文本文件。 def getNewsDetail(content): f=open('gzcc.txt','a',encoding='utf-8') f.write(content) f.close() 2. 将新闻数据结构化为字典的列表: #获取新闻详情信息 def getNewsDetail(newsUrl): resd... 阅读全文
posted @ 2018-04-17 22:00 248黄迎迎 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1. 用正则表达式判定邮箱是否输入正确。 q='^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$' qq='1280163615@qq.com' if re.match(q,qq): print(re.match(q,qq)) else: print("您输入的邮箱号码是错误的,请重新输入!") 2. 用正则表达式识别出全部电话号码... 阅读全文
posted @ 2018-04-10 17:41 248黄迎迎 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 1. 用requests库和BeautifulSoup库,爬取校园新闻首页新闻的标题、链接、正文。 import requests from bs4 import BeautifulSoup url="http://news.gzcc.cn/html/xiaoyuanxinwen/" res=requests.get(url) res.encoding='utf-8' soup=Beauti... 阅读全文
posted @ 2018-04-03 17:50 248黄迎迎 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 1 1.利用requests.get(url)获取网页页面的html文件 2 >>> import requests 3 >>> url='https://www.baidu.com/' 4 >>> res=requests.get(url) 5 >>> res.encoding='utf-8' 6 >>> res.text 7 \r\n 百度一下,你就知道 ... 阅读全文
posted @ 2018-03-29 10:48 248黄迎迎 阅读(199) 评论(0) 推荐(0) 编辑