| Data Evaluation |

- Use Shift + Enter or Shift + Return to run the upper box so as to make it display the edited text format. 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

- 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.

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄