Home > Blockchain >  Plotting Multiple boolean cols in seaborn
Plotting Multiple boolean cols in seaborn

Time:01-19

I got a DF with two column that shows if a person have dept in this month and the previous one.

Moroso morosoant
1      0
1      1
0      0

So I'd like to plot the amount of paid and unpaid for both cols.

I've tried this for ploting the values for just on

sn.catplot(kind="bar",x="MOROSO",y="MOROSO",data=pd.DataFrame(df["MOROSO"].value_counts()))

enter image description here

I would like to add the morosoant col next to the moroso column.

CodePudding user response:

Seaborn's works easiest with a dataframe in sns.catplot with kind='count'

PS: If df looks like:

   Moroso  Morosoant
0       0          1
1       1          1
2       1          0
3       1          1
4       0          1

Then df_long (before the replace) will look like:

    variable  Legend
0     Moroso       0
1     Moroso       1
2     Moroso       1
3     Moroso       1
4     Moroso       0
5  Morosoant       1
6  Morosoant       1
7  Morosoant       0
8  Morosoant       1
9  Morosoant       1
  •  Tags:  
  • Related