Find all the features among numerical features which have less than 20 unique numerical values in their data columns. (i.e. in a sense they are discrete variables despite having numerical values)
For these discrete variables, create bar plot with mean SalesPrice as Y-axis and their discrete values on x-axis.
i am not able to solve this question plz guide me.
sir please share screen shot so that we try to solve
i m not able too create logic for this. The last part is troubling me (‘create bar plot with mean SalesPrice as Y-axis and their discrete values on x-axis.’). I m not phasing any error or something else the problem is that i m failed to build logic.
Hope this helps
df_housing_numerical = df_housing.select_dtypes(include = 'number')
for column in df_housing_numerical:
if df_housing_numerical[column].nunique()<20: #features among numerical features which have less than 20 unique numerical values
plt.figure(figsize = (10,5))
sns.barplot(x = column, y = 'SalePrice', data = df_housing_numerical)