python数据处理过程——房价预测

 

参考:https://blog.csdn.net/Amy_mm/article/details/79538083

https://www.kaggle.com/pmarcelino/comprehensive-data-exploration-with-python(处理回归)

https://www.kaggle.com/pmarcelino/data-analysis-and-feature-extraction-with-python/data#Exploratory-data-analysis-and-feature-extraction-with-Python(处理分类)

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns  # 统计绘图

from sklearn.preprocessing import StandardScaler
from scipy.stats import norm
from scipy import stats  # 统计

import warnings

warnings.filterwarnings('ignore')
df_train = pd.read_csv('train.csv')
df_test = pd.read_csv('test.csv')
print(f"columns:{df_train.columns}")

python数据处理过程——房价预测_第1张图片

print(df_train['SalePrice'].describe())

python数据处理过程——房价预测_第2张图片

sns.distplot(df_train['SalePrice'])
plt.show()

python数据处理过程——房价预测_第3张图片

#show skewness and Kurtosis  偏态和峰度
print("Skewness : %f " % df_train['SalePrice'].skew())
print("Kurtosis : %f " % df_train['SalePrice'].kurt())

# scatter plot  Grlivearea / SalePrice
var = 'GrLivArea'
# pd.concat 函数可以将数据根据不同的轴作简单的融合 axis = 0-->代表行  axis = 1 --> 代表列
data = pd.concat([df_train['SalePrice'], df_train[var]], axis=1)
data.plot.scatter(x=var, y='SalePrice', ylim=(0, 800000))
plt.show()

python数据处理过程——房价预测_第4张图片

你可能感兴趣的:(python,数据分析)