数据查看,可视化 了解预测分布
pycharm 使用seaborn需要加plt.show()
import warnings
warnings.filterwarnings('ignore')
import scipy.stats as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import missingno as msno
Train_data = pd.read_csv('used_car_train_20200313.csv',sep=',')
Test_data = pd.read_csv('used_car_testA_20200313.csv',sep=' ')
Train_data.head().append(Train_data.tail())
# print(Train_data.describe())
# print(Train_data.info())
# print(Train_data.isnull().sum())
# missing = Train_data.isnull().sum()
# missing = missing[missing>0]
# missing.sort_values(inplace = True)
# missing.plot.bar()
# msno.matrix(Train_data.sample(250))
print(Train_data['price'].value_counts())
y = Train_data['price']
plt.figure(1); plt.title('Johnson SU')
sns.distplot(y, kde=False, fit=st.johnsonsu)
plt.figure(2); plt.title('Normal')
sns.distplot(y, kde=False, fit=st.norm)
plt.figure(3); plt.title('Log Normal')
sns.distplot(y, kde=False, fit=st.lognorm)
plt.show()
plt.hist(Train_data['price'], orientation = 'vertical',histtype = 'bar', color ='red')
plt.show()
``