r"""Display a Distribution Plot. Parameters ---------- df : pandas.DataFrame The dataframe containing the ``target`` feature. target : str The target variable for the distribution plot. tag : str Unique identifier for the plot. directory : str, option
(df, target, tag='eda', directory=None)
| 1037 | # |
| 1038 | |
| 1039 | def plot_distribution(df, target, tag='eda', directory=None): |
| 1040 | r"""Display a Distribution Plot. |
| 1041 | |
| 1042 | Parameters |
| 1043 | ---------- |
| 1044 | df : pandas.DataFrame |
| 1045 | The dataframe containing the ``target`` feature. |
| 1046 | target : str |
| 1047 | The target variable for the distribution plot. |
| 1048 | tag : str |
| 1049 | Unique identifier for the plot. |
| 1050 | directory : str, optional |
| 1051 | The full specification of the plot location. |
| 1052 | |
| 1053 | Returns |
| 1054 | ------- |
| 1055 | None : None. |
| 1056 | |
| 1057 | References |
| 1058 | ---------- |
| 1059 | |
| 1060 | http://seaborn.pydata.org/generated/seaborn.distplot.html |
| 1061 | |
| 1062 | """ |
| 1063 | |
| 1064 | logger.info("Generating Distribution Plot") |
| 1065 | |
| 1066 | # Generate the distribution plot |
| 1067 | |
| 1068 | dist_plot = sns.distplot(df[target]) |
| 1069 | dist_fig = dist_plot.get_figure() |
| 1070 | |
| 1071 | # Save the plot |
| 1072 | write_plot('seaborn', dist_fig, 'distribution_plot', tag, directory) |
| 1073 | |
| 1074 | |
| 1075 | # |
nothing calls this directly
no test coverage detected