Learning notes | Data Analysis: 1.1 data eval…
2018-10-29 15:30:58来源:博客园 阅读 ()
| Data Evaluation |
- Use Shift + Enter or Shift + Return to run the upper box so as to make it display the edited text format.
- Markdown used for text writing, while the other is Code cell used for code writing.
import csv import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn %matplotlib inline
# Import/load the data set use the read_csv function of Pandas
Shanghai_data = pd.read_csv('ShanghaiPM20100101_20151231.csv')
# View the basic information of data by means of head, info and describe.
Shanghai_data.head()
Shanghai_data.info()
# Print type of python object
print(type(Shanghai_data['cbwd'][0]))
# Change the space into an underline
Shanghai_data.columns = [c.replace(' ', '_') for c in Shanghai_data.columns]
# Convert the numerical value of 1, 2, 3, 4 to four corresponding seasons (by means of the map method of Pandas):
Shanghai_data['season'] = Shanghai_data['season'].map({1:'Spring', 2:'Summer', 3:'Autumn', 4: 'Winter'})
- Check data missing and data type:
# Print the length of data
print("The number of row in this dataset is ",len(Shanghai_data.index))
# Calculating the number of records in column "PM_Jingan"
print("There number of missing data records in PM_Jingan is: ",len(Shanghai_data.index) - len(Shanghai_data['PM_Jingan'].dropna()))
Note: # “dropna()” function used in the following code can delete missing value in data.
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- 那些搜过很多遍的python基础知识 2019-07-24
- Python-14-常用模块 2019-07-24
- python实现数据分页小练习 2019-07-24
- datatime模块 2019-07-24
- Python网络编程 2019-05-04
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash