以下为python pandas 库的dataframe pivot()函数用法解析。
简而言之,我理解的pivot()的用途就是,将一个dataframe的记录数据整合成表格,而且是按照pivot(‘index=xx’,’columns=xx’,’values=xx’)来整合的。还有另外一种写法,
但是官方貌似并没有给出来,就是pivot(‘索引列’,‘列名’,‘值’)。
下面是官方描述:
============================================================================
Reshape data (produce a “pivot” table) based on column values. Uses unique values from index / columns to form axes of the resulting DataFrame.
译:重塑数据(产生一个“pivot”表格)以列值为标准。使用来自索引/列的唯一的值(去除重复值)为轴形成dataframe结果。