I have a data frame with the following rows:
protein IHD CM ARR VD CHD CCD VOO 0 q9uku9 0.000000 0.039457 0.032901 0.014793 0.006614 0.006591 0.000000 1 o75461 0.000000 0.005832 0.027698 0.000000 0.000000 0.006634 0.000000
etc.
I want a heatmap of the disease names (IHD, CM, etc) on the X axis with the protein name on the y=axis. I’m running into a float issue since the protein column is in letters. On my heatmap, I want the protein name to show though, so it wouldn’t be helpful to just drop the entire column. Does anyone have any tips on how to do this?
Advertisement
Answer
You can try to drop the protein column from the dataframe.
Editing with the suggestion from the comments.
Also, the solution encompasses the case where you have a large list of diseases.
import seaborn as sns list_proteins = df['protein'].unique() y = df["protein"] df = df.drop(['protein'], axis=1) column_name_list = df.columns.tolist() sns.heatmap(df, xticklabels=column_name_list , yticklabels=list_proteins)