Pandas 'describe' is not returning summary of all columns

后端 未结 6 1974
野的像风
野的像风 2020-12-23 16:16

I am running \'describe()\' on a dataframe and getting summaries of only int columns (pandas 14.0).

The documentation says that for object columns frequency of most

6条回答
  •  一向
    一向 (楼主)
    2020-12-23 17:03

    In addition to DataFrame.describe(include = 'all') one can also use Series.value_counts() for each categorical column:

    In[1]:
    
    df = pd.DataFrame({'$a':['a', 'b', 'c', 'd', 'a'], '$b': np.arange(5)})
    df['$a'].value_counts()
    
    Out[1]:
    $a
    a    2
    d    1
    b    1
    c    1
    

提交回复
热议问题