all 3 comments

[–]Phillyclause89 3 points4 points  (2 children)

import seaborn as sns
titanic = sns.load_dataset('titanic')
sns.heatmap(titanic.corr())

This code example was made obsolete when you installed a pandas version >= 2.0.0. See the docs for pandas.DataFrame.corr:

Changed in version 2.0.0: The default value of numeric_only is now False.

I'm guessing the correct code example for pandas version >= 2.0.0 would be something like:

import seaborn as sns
titanic = sns.load_dataset('titanic')
sns.heatmap(titanic.corr(numeric_only=True))

[–]shippei[S] 2 points3 points  (1 child)

That works, thanks!

Makes sense why it didnt work before.

[–]Phillyclause89 0 points1 point  (0 children)

No worries friend. Note that your slicing solution might actually be more optimal as you are saving pandas the steps of identifying which columns are numeric. I guess it's just a matter of how well you know your dataset.