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