Skip to content

Instantly share code, notes, and snippets.

@smzn
Last active January 22, 2024 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smzn/8d22018b21aed8272e38623d90314631 to your computer and use it in GitHub Desktop.
Save smzn/8d22018b21aed8272e38623d90314631 to your computer and use it in GitHub Desktop.
数値データヒストグラム
import matplotlib.pyplot as plt
import seaborn as sns
# Set the aesthetic style of the plots
sns.set_style("whitegrid")
# Selecting a subset of columns for plotting histograms
# Excluding binary columns for more meaningful histograms
hist_columns = ['BMI', 'Age', 'GenHlth', 'MentHlth', 'PhysHlth', 'Education', 'Income']
# Plotting histograms for selected columns
plt.figure(figsize=(15, 10))
for i, column in enumerate(hist_columns, 1):
plt.subplot(3, 3, i)
sns.histplot(data[column], kde=False, bins=30)
plt.title(column)
plt.tight_layout()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment