pandas describe by - additional parameters

后端 未结 3 773
既然无缘
既然无缘 2021-02-06 11:20

I see that the pandas library has a Describe by function which returns some useful statistics. However, is there a way to add additional rows to the output such as

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-06 11:38

    The answer from piRSquared makes the most sense to me, but I get a deprecation warning about reindex_axis in Python 3.5. This works for me:

        stats = data.describe()
        stats.loc['IQR'] = stats.loc['75%'] - stats.loc['25%'] # appending interquartile range instead of recalculating it
        stats = stats.append(data.reindex(stats.columns, axis=1).agg(['skew', 'mad', 'kurt']))
    

提交回复
热议问题