Extract values in Pandas value_counts()

前端 未结 6 1346
余生分开走
余生分开走 2020-11-30 19:13

Say we have used pandas dataframe[column].value_counts() which outputs:

 apple   5 
 sausage 2
 banana  2
 cheese  1

How do yo

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 19:33

    If anyone missed it out in the comments, try this:

    dataframe[column].value_counts().to_frame()
    

提交回复
热议问题