数据清洗--1. Introduction of Data Wrangling

数据清洗简介

Data Wrangling–regular expression


前言

Raw data ⇒ Data Wrangling ⇒ Tidy data ⇒ Data Analysis ⇒ Data Knowledge
Data + Wrangling + Analysis = Data Product (or Knowledge)

初始被采集的数据是原始数据(Raw data),比如从传感器获得的数据,从不同网站爬取的数据,未做过处理的用户历史数据等。这些数据并不能直接进行存储或使用,因为这些数据并不足够“干净”。


一、Data Wrangling 的目的

Data Wrangling 的目的:

  1. 对数据进行处理,已达到满足后续的数据分析或储存的要求;
  2. 记录数据被处理的过程。

二、数据可能存在的问题

  • Interpretability issue (数据可理解性)
  • Data format issues (数据格式问题)
  • Inconsistent and faulty data (数据不一致或错误数据)
  • Missing values (数据缺失)
  • Outliers (离群值)
  • Duplicates (重复)

1. Interpretability issue (数据可理解性)

Interpretability issue
只给你上图,请问这组数据是说明什么的?

由于没有attribute names,所以并不能很好的判断这组数据是关于什么的,这就是可理解性问题。

注:上图中的 “?” 并不是可理解性问题,是数据缺失。

2. Data format issues (数据格式问题)

Data format issues (数据格式问题)
在处理数据之前,要确定好你的输入文件的数据格式是什么,主要包括文件的format/structure和数据的type。又因为有些时候需要合并不同数据来源的数据,但是不同的数据来源可能储存数据的格式是不一样的,比如在A来源数据储存在 JSON 格式下,B来源用的是XML,或者A来源储存相同的意义的数据用chr/string type,但在B来源用的是int/float type, 这就是格式问题。

3. Inconsistent and faulty data (数据不一致或错误数据)

Inconsistent and faulty data
上图所示,存在的数据不一致或错误你能发现几个?

  • 姓名的格式不一致
  • 日期的格式不一致
  • 85年33岁,82年却显示34岁,同样82年,另一个显示36岁
  • 第三行,第四列的身高写成了 ’17o‘,应该是’170‘
  • 性别的格式不一致
  • 第二个电话明显是错误的
  • 最后一列2行的地址多了一个空格(千万不要小看或者忽视空格)

4. Missing values (缺失值)

missing values
缺失值,顾名思义,就是指数据中由于各种各样原因缺失的数据。

5. Outliers (离群值)

outliers
离群值有时可能是要去除的(如:大多数情况的数据建模),有时是需要注意的(如:异常检测)

6. Duplicates (重复)

duplication
这里的数据重复不仅指完全一样的数据,还包括粗看有区别,但是仔细一看,其实表达的是相同的实体的重复的数据。


总结

data wrangling process
总体上数据清洗的步骤如山图所示:

  • 数据获取:从不同的数据来源获取数据,比如官方的API,网络爬取,自家数据来源等
  • 数据加载、提取:加载并解析不同储存形式的数据
  • 数据清洗:诊断并处理各种存在的数据问题
  • 数据归集:合并不同来源的数据,创造出一个丰富且完整的数据集
  • 数据研究:利用不同种类的描述性统计和可视化工具来提高数据质量
  • 数据丰富:通过特征生成、数据转换、数据聚合和数据缩减(缩减颗粒度)来丰富现有数据
  • 数据储存&使用:最后以各种格式存储干净的数据,便于下游分析工具访问。
Key Features An easy to follow guide taking you through every step of the data wrangling process in the best possible way Work with different types of datasets, and reshape the layout of your data to make it easier for analysis Simple examples and real-life data wrangling solutions for data pre-processing Book Description Around 80% of time in data analysis is spent on cleaning and preparing data for analysis. This is, however, and important task, and is a prerequisite to the rest of the data analysis workflow, including visualization, analysis and reporting. Python and R are considered a popular choice of tool for data analysis, and have packages which can be best used to manipulate different kinds of data, as per your requirement. This book will show you the different data wrangling techniques, and how you can leverage the power of Python and R packages to implement them. You will start with understanding the data wrangling process and get a solid foundation for working with different types of data. You will work with different data structures and aqquire and parse data from various locations. The book will also show you how to reshape the layout of data and manipulate, summarize, and join data sets. Finally, the book includes a quick primer on accessing and processing data from databases, conduct data exploration, and store and retrieve data quickly using databases. The book will include practical examples on each of the above pointers using simple and real-world datasets for easier understanding. By the end of the book, you will have a thorough understanding of all the data wrangling concepts and how to implement them in the best possible way. What you will learn Read a csv file into python and R, and print out some statistics on the data. Gain knowledge of the data formats and programming stuctures involved in retrieving API data. Make effective use of regular expression in the data wrangling process. Explore the tools and packages available for preparing numerical data for analysis. Learn how to have better control over the manupulation of the structure of the data. Create a dexterity for programmatically reading, auditing, correcting, and shaping data. Write and complete programs for taking in, formatting and outputting datasets.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值