data={
'Age' : [10,None, 30],
'Name' : ['a', 'b', None],
'City' : ['x', 'y', 'z'],
}
df=pd.DataFrame(data)
print(df)
df_fill=df.fillna({'Name' : 'Gilbert', 'Age' : df['Age'].mean()})
print(df_fill)
df_drop=df.dropna()
print(df_drop)
print("no of missing values : \n",df.isnull().sum())
import matplotlib.pyplot as plt
x=[1,2,3,4,5]
y=[14,46,8,72,34]
plt.plot(x,y)
plt.title("practice plot")
plt.xlabel("X")
plt.ylabel("Y")
plt.show()
Comments