347-12 Tried to create visualisation for deciding dropna or filling missing value

Screen Link:
https://app.dataquest.io/m/347/working-with-missing-and-duplicate-data/12/dropping-rows

My Code:
‘’’
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

fig = plt.figure(figsize=(5, 10))
ax1 = fig.add_subplot(2,1,1)

missing1 = combined.isnull().sum()

group = combined.groupby(“REGION”).count()

happiness_mean = combined[“HAPPINESS SCORE”].mean()
print(happiness_mean)
combined[“HAPPINESS SCORE UPDATED”] = combined[“HAPPINESS SCORE”].fillna(happiness_mean)
print(combined[“HAPPINESS SCORE UPDATED”].mean())

ax1 = sns.distplot(combined[combined[“HAPPINESS SCORE”].notnull()][“HAPPINESS SCORE”],kde=False)
ax1.axvline(happiness_mean, color=‘b’, linestyle=’-’)

ax2 = fig.add_subplot(2,1,2)

ax2 = sns.distplot(combined[“HAPPINESS SCORE UPDATED”],kde=False)
ax2.axvline(combined[“HAPPINESS SCORE UPDATED”].mean(), color=‘b’, linestyle=’-’)

plt.tight_layout()
plt.show()

combined = combined.drop(columns=[“HAPPINESS SCORE UPDATED”])
combined = combined.dropna()

missing = combined.isnull().sum()

hi @eashwary

Is this a question or you are just sharing your code for reference for other students? Please clarify.

tried to create visualisation which was given in read section of that tutorial for deciding values to be dropped or to be filled. Modified tag as social share now.