0

Is there a way to do a sns heatmap only from specific columns from my dataframe? I have my dataframe named dt. It consists of columns A, B, C, D. Can I do a heatmap only from A, B, and C?

I thought to do a list from my variables, like: List = [A, B, C] And then instead of doing dt.corr to do it on the list, but it doesn't seem to work. any suggestions?

sns.heatmap(dt.corr(), annot=True, cmap="YlGnBu", linewidths=.5, fmt= '.1f')
fig=plt.gcf()
fig.set_size_inches(10,8)
plt.show()
  • if you replace `dt.corr()` by `dt[['A','B','C']].corr()` does it do what you want? – Ben.T May 05 '20 at 15:04
  • Does this answer your question? [Selecting multiple columns in a pandas dataframe](https://stackoverflow.com/questions/11285613/selecting-multiple-columns-in-a-pandas-dataframe) – Ben.T May 05 '20 at 15:06
  • 1
    Yes!!! thank you (: Is there a problem to put a list into corr? that's why I couldn't do it? – JustEquvilant May 05 '20 at 15:14

0 Answers0