This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| train['SalePrice'].describe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import seaborn as sns | |
| sns.distplot(train['SalePrice']) | |
| plt.xticks(rotation=30); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print('Skewness = ',train['SalePrice'].skew()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| target = np.log(train['SalePrice']) | |
| print('Skewness = ',target.skew()) | |
| sns.distplot(target); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| corr = train.corr() | |
| corr['SalePrice'].sort_values(ascending=False).head(10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| table = pd.pivot_table(train,index='OverallQual',values='SalePrice',aggfunc=np.mean) | |
| table |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plt.scatter(x=train['GrLivArea'], y=train['SalePrice']) | |
| plt.ylabel('Sale Price') | |
| plt.xlabel('GrLivArea') | |
| plt.show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # dropping outlier values from the dataset | |
| train = train[train['GrLivArea']<4500] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #train rows | |
| ntrain = train.shape[0] | |
| #save log transform of target feature | |
| target = np.log(train['SalePrice']) | |
| #drop Id and SalePrice from train dataframe | |
| train.drop(['Id','SalePrice'],inplace=True,axis=1) | |
| #store test Id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Null values | |
| train.isna().sum().sort_values(ascending=False).head(20) |