It seems to me the heatmap function is applied to the dataframe in its entirety. What if I only want the heatmap applied to a given set of column(s) from my dataset? I would imagine this can be achieved by smartly using cmap, but cannot seem to get it to work.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Pass the desired sub-DataFrame to
seaborn.heatmap
:df[[col1, col2, ..., coln]]
returns a DataFrame composed of the columnscol1
,col2
, ...coln
fromdf
. Note the double brackets.If you wish to highlight only certain values and plot the heatmap as though all other values are zero, you could make a copy of the DataFrame and set those values to zero before calling
heatmap
. For example, modifying the example from the docs,yields