I am working on a data set of House Pricing - Advanced Regression .
To Visualize my data after some cleaning I used sns.distplot()
but its showing "FutureWarning: distplot
is a deprecated function and will be removed in a future version."
Here is code when I used distplot()
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
num_var = ['MSSubClass', 'LotArea', 'OverallQual', 'OverallCond',
'YearBuilt', 'YearRemodAdd', 'MasVnrArea', 'BsmtFinSF1', 'BsmtFinSF2',
'BsmtUnfSF', 'TotalBsmtSF', '1stFlrSF', '2ndFlrSF', 'LowQualFinSF',
'GrLivArea', 'BsmtFullBath', 'BsmtHalfBath', 'FullBath', 'HalfBath',
'BedroomAbvGr', 'KitchenAbvGr', 'TotRmsAbvGrd', 'Fireplaces',
'GarageYrBlt', 'GarageCars', 'GarageArea', 'WoodDeckSF', 'OpenPorchSF',
'EnclosedPorch', '3SsnPorch', 'ScreenPorch', 'PoolArea', 'MiscVal',
'MoSold', 'YrSold', 'SalePrice']
plt.figure(figsize=(25,25))
for i,var in enumerate(num_var):
plt.subplot(9,4,i+1)
sns.distplot(df[var],bins=20)
sns.distplot(df3_drop_rows[var],bins=20)
#num_var = columns of my data
#df = Original data
#df3_drop_rows = Data After cleaning ( Simple cleaning just droped some rows and columns )
So then I tried to use displot()
instead of distplot()
after going through documentation and some stack overflow Answers then I changed my code to this
num_var = ['MSSubClass', 'LotArea', 'OverallQual', 'OverallCond',
'YearBuilt', 'YearRemodAdd', 'MasVnrArea', 'BsmtFinSF1', 'BsmtFinSF2',
'BsmtUnfSF', 'TotalBsmtSF', '1stFlrSF', '2ndFlrSF', 'LowQualFinSF',
'GrLivArea', 'BsmtFullBath', 'BsmtHalfBath', 'FullBath', 'HalfBath',
'BedroomAbvGr', 'KitchenAbvGr', 'TotRmsAbvGrd', 'Fireplaces',
'GarageYrBlt', 'GarageCars', 'GarageArea', 'WoodDeckSF', 'OpenPorchSF',
'EnclosedPorch', '3SsnPorch', 'ScreenPorch', 'PoolArea', 'MiscVal',
'MoSold', 'YrSold', 'SalePrice']
plt.figure(figsize=(25,25))
for i,var in enumerate(num_var):
plt.subplot(9,4,i+1)
sns.displot(data=df[var],kde=True)
sns.displot(data=df3_drop_rows[var],kde=True)
I got this output after doing some correction
But my Issue is , I want output like first image i.e I want to plot both of my original data and cleaned data in one graph and all 36 graphs in ( 9 rows , 4 columns ) format.