码迷,mamicode.com
首页 > 其他好文 > 详细

Data Cleaning 3

时间:2016-10-23 12:10:18      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:draw   from   sch   data   line   awr   bsp   ram   span   

1. Find correlations for each type of data by using corr()

  correlations = combined.corr(method = "pearson")
  print(correlations["sat_score"])

note: The value of correlation is from -1 to 1. If the data close to 1, they are positive correlated. If the value close to -1, they are negative correlated. If the data close to 0, they are not correlated.  

2. Then we can plot these data by using plot() function.

  %matplotlib inline

  import matplotlib.pyplot as plt

  combined.plot(‘total_enrollment‘,‘sat_score‘,kind = "scatter") #plot(x,y,kind)

3. Then we can filter the data to digging some info we need. 

4. We mapping out the school we need in certain area.

  from mpl_toolkits.basemap import Basemap

  m = Basemap(projection = "merc",llcrnrlat = 40.496044, urcrnrlat = 40.915256, llcrnrlon = -74.255735,urcrnrlon = -73.700272,resolution = "i") # urcrnrlon =  upper right corner longititude. llcrnrlon = lower left corner longitude. urcrnrlat = upper right corner latitute,llcrnrlat = lower left corner latitude.
  m.drawmapboundary(fill_color=‘#85A6D9‘)
  m.drawcoastlines(color=‘#6D5F47‘, linewidth=.4)
  m.drawrivers(color=‘#6D5F47‘, linewidth=.4)

  latitudes = combined["lat"].tolist()
  longitudes = combined["lon"].tolist()

  m.scatter(longitudes,latitudes,s = 20, zorder = 2 , latlon = True ) # scatter can only shows the list.

5. We can change the parameter of the scatter() to change the 
  plt.show

Data Cleaning 3

标签:draw   from   sch   data   line   awr   bsp   ram   span   

原文地址:http://www.cnblogs.com/kingoscar/p/5989106.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!