天天看点

pandas 透视表 pivot_table

The function pandas.pivot_table can be used to create spreadsheet-style pivot tables.

It takes a number of arguments

    data: A DataFrame object

    values: a column or a list of columns to aggregate

    index: a column, Grouper, array which has the same length as data, or list of them. Keys to group by on the pivot table index. If an array is passed, it is being used as the same manner as column values.

    columns: a column, Grouper, array which has the same length as data, or list of them. Keys to group by on the pivot table column. If an array is passed, it is being used as the same manner as column values.

    aggfunc: function to use for aggregation, defaulting to numpy.mean

<a></a>

 本文转自罗兵博客园博客,原文链接:http://www.cnblogs.com/hhh5460/p/5597314.html,如需转载请自行联系原作者