python网络数据采集这本书怎么样_《Python网络数据采集》读后总结--第7章清洗脏数据...

《Python网络数据采集》这本书的Chpt07清洗脏数据的介绍,

这几章主要是一些具体功能介绍,我就列出一些要点,具体看示例就可以了。

Chpt07.Cleaning Your Dirty Data

这章主要介绍简单的2维分词和基本的清理工作。

同时提了一下OpenRefine,不过这部分介绍的不是很清楚,我补了一些例子。初步花了点时间看OpenRefine,感觉作为DataQuality工具还是很有特色的,

不过Reconcile很多基于Freebase,google宣布放弃Freebase转向Wikidata,这个工具怎么调整,还不知道了。

OpenRefine具体介绍我写了一篇专门介绍。

示例代码:

1-2grams.py.py

2-clean2grams.py

2维分词接不介绍了,后面一章介绍自然语言分析,具体看那个就可以了。

大家就看一下

清理数据和标准化的简单示例:

input = re.sub('\n+', " ",

input) #replaces all instances of the newline character

input = re.sub('\[[0-9]*\]', "", input) #去除[11] 这些数据

input = re.sub(' +', " ",

input) #replaces all instances of multiple spaces in a row with a

singlespace,

input = bytes(input,

"UTF-8") #escape charactersare eliminated by encoding the content with

UTF-8.

input = input.decode("ascii", "ignore")

item=item.strip(string.punctuation) #去除符号print(string.punctuation)

!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

代码:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值