0

I have a pandas data frame with each row of data containing an id and several binary data that has only two options 0 or 1.

id, feat1, feat2, feat3, feat4
aa, 0, 1, 1, 0
ab, 1, 0, 1, 0
ac, 0, 0, 1, 0

and etc

I want to be able to visualise this with id on y-axis, and all features on x axis.. with a dot representing 1 and no dot representing 0.. almost like the above dataframe but in plot form

1 Answer 1

1

You may consider the heatmap:

import seaborn as sns
ax = sns.heatmap(df.set_index('id'), annot = True)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.