0

I'm generating some counts with this code:

df1 = (df.loc[df['Are you okay?']== 'No', 'Are yu sad?']
     .value_counts()
     .rename_axis('Vals')
     .reset_index(name='Count'))

So I'm obtaining the Yes and No Counts, but this is for 3 diferent columns and the only count that I need is Yes this is what I got:

    Vals    Count
0   Yes 0.544
1   No  0.456

But I have this:

enter image description here

And I want to have something like this:

    Vals    Count
0   Yes     0.544
1   Yes(1)  0.032
2   Yes(2)  0.384
  • Try incrementing a variable and by `f-strings` you could print the desired value? Also try sorting out the `No` values https://stackoverflow.com/questions/18172851/deleting-dataframe-row-in-pandas-based-on-column-value. You can make a `.copy()` and delete the values. – The Myth Nov 04 '22 at 19:52

1 Answers1

0
df_all_rows = pd.concat([df1, df2, df3], ignore_index=True)