天天看點

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,如需轉載請自行聯系原作者