INNER CODE UNIT · Python
discrete_var_boxplot
ashishpatel26/Amazing-Feature-Engineering · data_exploration/explore.py:105
def discrete_var_boxplot(x,y,data,output_path=None):
"""draw the boxplot of a discrete variable x against y.
Parameters
----------
Returns
-------
figure save as PNG
"""
plt.figure(figsize=(15,10))
sns.boxplot(x=x,y=y,data=data)
if output_path is not None:
output = os.path.join(output_path,'Boxplot_'+str(x)+'_'+str(y)+'.png')
plt.savefig(output)
print('Image saved at',str(output))