From 70cf42d37f0fd7acdb1dbf359b86c59cd501d957 Mon Sep 17 00:00:00 2001 From: Ben Wallace Date: Fri, 21 Jul 2023 21:21:55 -0600 Subject: [PATCH] Update 5/1/README.md Visualizing the heatmap with `df` will throw an error because there are string-type columns. Filter the data with only numberic data types. --- 5-Clustering/1-Visualize/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/5-Clustering/1-Visualize/README.md b/5-Clustering/1-Visualize/README.md index cbff4726..61dd0843 100644 --- a/5-Clustering/1-Visualize/README.md +++ b/5-Clustering/1-Visualize/README.md @@ -258,9 +258,12 @@ Note, when the top genre is described as 'Missing', that means that Spotify did 1. Do a quick test to see if the data correlates in any particularly strong way: ```python - corrmat = df.corr() - f, ax = plt.subplots(figsize=(12, 9)) - sns.heatmap(corrmat, vmax=.8, square=True) + # Create a DF of only numeric columns + df_num = df.select_dtypes(include=['int64', 'float64']) + + corrmat = df_num.corr() + f, ax = plt.subplots(figsize=(12, 9)) + sns.heatmap(corrmat, vmax=.8, square=True) ``` ![correlations](images/correlation.png)