Rms-Blog

一、导包

  1. import warnings首次使用了warning库,通过设置warnings.filterwarnings(\'ignore\'),可以忽略掉出现的长篇警告;

  2. plt.rcParams[\'font.sans-serif\'] = \'Songti SC\':设置全局字体,解决绘图时中文乱码问题(详细设置方法在另一篇博客中)。

 

二、数据清洗

  1. copy():在操作数据之前先将数据copy一份,保证原始数据的清洁性;

  2. 列属性位置的重新摆放:    

  columns = [\'Region\',\'District\',\'Garden\',\'Layout\',\'Floor\',\'Year\',\'Size\',\'Elevator\',
             \'Direction\',\'Renovation\',\'PerPrice\',\'Price\']
  df = pd.DataFrame(df,columns = columns)

 

三、数据可视化分析

  1. reset_index():重置索引;

  2. 创建多个子视图对象:f,[ax1,ax2,ax3] = plt.subplots(3,1,figsize = (20,18));

  3. seaborn绘图写法:seaborn.barplot(参数);

  4. sns.distplot():绘制直方图;

  5. sns.kdeplot():绘制核密度图;

  6. sns.regplot():绘制散点图(回归图);

  7. 核密度图如果呈现长尾型,说明存在很多比较大的数据。  

 

分类:

技术点:

相关文章: