2018年5月24日

摘要: Hadoop综合大作业 要求: 1.用Hive对爬虫大作业产生的文本文件(或者英文词频统计下载的英文长篇小说)进行词频统计。 我下载的是一篇英文长篇小说《教父》,字数为个, 将文章(godfather.txt)放在了wc文件中: 启动hadoop: 文件上传至hdfs 启动hive hive 创建原 阅读全文
posted @ 2018-05-24 14:17 134朱晓航 阅读(127) 评论(0) 推荐(0) 编辑
 

2018年5月9日

摘要: 1. 用Python编写WordCount程序并提交任务 程序 WordCount 输入 一个包含大量单词的文本文件 输出 文件中每个单词及其出现次数(频数),并按照单词字母顺序排序,每个单词和其频数占一行,单词和频数之间有间隔 编写map函数,reduce函数 cd /home/hadoop/wc 阅读全文
posted @ 2018-05-09 13:01 134朱晓航 阅读(157) 评论(0) 推荐(0) 编辑
 

2018年5月4日

摘要: 1. 以下关系型数据库中的表和数据,要求将其转换为适合于HBase存储的表并插入数据: 学生表(Student)(不包括最后一列) 学号(S_No) 姓名(S_Name) 性别(S_Sex) 年龄(S_Age) 课程(course) 2015001 Zhangsan male 23 2015003 阅读全文
posted @ 2018-05-04 19:03 134朱晓航 阅读(145) 评论(0) 推荐(0) 编辑
 

2018年4月26日

摘要: 一、Hadoop提供的Shell命令完成相同任务: 在本地Linux文件系统的“/home/hadoop/”目录下创建一个文件txt,里面可以随意输入一些单词. 在本地查看文件位置(ls) 在本地显示文件内容 cd /usr/local/hadoop touch hello.txt cat hell 阅读全文
posted @ 2018-04-26 11:25 134朱晓航 阅读(129) 评论(0) 推荐(0) 编辑
 

2018年4月23日

摘要: 1.选一个自己感兴趣的主题或网站。(所有同学不能雷同) 爬取食谱网(香哈网)的食谱内使用过的食材 2.用python 编写爬虫程序,从网络上爬取相关主题的数据。 from bs4 import BeautifulSoup as bs from urllib.request import Reques 阅读全文
posted @ 2018-04-23 09:47 134朱晓航 阅读(236) 评论(0) 推荐(0) 编辑
 

2018年4月16日

摘要: 1. 将新闻的正文内容保存到文本文件。 2. 将新闻数据结构化为字典的列表: 单条新闻的详情-->字典news 一个列表页所有单条新闻汇总-->列表newsls.append(news) 所有列表页的所有新闻汇总列表newstotal.extend(newsls) import pandas imp 阅读全文
posted @ 2018-04-16 20:44 134朱晓航 阅读(104) 评论(0) 推荐(0) 编辑
 

2018年4月9日

摘要: #判断邮箱电话格式 a = "1207384251@qq.com" b = '020-12345678' mail = re.search('\d{6,12}@[a-zA-Z0-9]+.[a-zA-Z0-9]+', a).group(0) tele_num = re.search('\d{3,4}-\d{6,8}', b).group(0) print(mail+'\n'+tele_num) ... 阅读全文
posted @ 2018-04-09 22:44 134朱晓航 阅读(99) 评论(0) 推荐(0) 编辑
 

2018年4月3日

摘要: import requests from bs4 import BeautifulSoup from datetime import datetime url = "http://news.gzcc.cn/html/xiaoyuanxinwen/" res = requests.get(url) res.encoding = "utf-8" soup = BeautifulSoup(res.t... 阅读全文
posted @ 2018-04-03 10:07 134朱晓航 阅读(118) 评论(0) 推荐(0) 编辑
 

2018年3月29日

摘要: import requests from bs4 import BeautifulSoup newsurl='http://localhost:63342/untitled/3/29.html?_ijt=ltocl4v68kb1po4608e3291lkm' res=requests.get(newsurl) res.encoding="utf-8" soup=BeautifulSoup(res... 阅读全文
posted @ 2018-03-29 20:26 134朱晓航 阅读(133) 评论(0) 推荐(0) 编辑
 

2018年3月26日

摘要: file=open('song.txt','r',encoding='utf-8') str=file.read() # 将文章里的标点符号替换为空格 wordList =str.lower().split() # 将数组变成一个个个单词 sep=''',.'"?!:''' word = ['it', 'you', 'a', 'and', 'for', 'on', 'the 阅读全文
posted @ 2018-03-26 19:27 134朱晓航 阅读(141) 评论(0) 推荐(0) 编辑