MCPcopy Create free account
hub / github.com/Riley702/enhanced_benchmark_tool / plot_feature_distribution

Function plot_feature_distribution

src/visualizations.py:234–252  ·  view source on GitHub ↗

Plots the distribution of a numerical feature. Args: df (pd.DataFrame): DataFrame containing the feature. feature (str): Column name of the numerical feature. bins (int): Number of bins for the histogram. Returns: None

(df, feature, bins=30)

Source from the content-addressed store, hash-verified

232
233
234def plot_feature_distribution(df, feature, bins=30):
235 """
236 Plots the distribution of a numerical feature.
237
238 Args:
239 df (pd.DataFrame): DataFrame containing the feature.
240 feature (str): Column name of the numerical feature.
241 bins (int): Number of bins for the histogram.
242
243 Returns:
244 None
245 """
246 plt.figure(figsize=(8, 6))
247 sns.histplot(df[feature], bins=bins, kde=True, color="blue")
248 plt.xlabel(feature)
249 plt.ylabel("Frequency")
250 plt.title(f"Distribution of {feature}")
251 plt.grid(alpha=0.5)
252 plt.show()
253
254
255def plot_boxplots_for_numerical_features(df, numerical_features):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected