Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

DataFrame.pivot vs pandas.pivot_table

  1. Both DataFrame.pivot and pandas.pivot_table can generate pivot tables. pandas.pivot_table aggregate values while DataFrame.pivot not.

Loading...
Loading...

DataFrame.pivot

The values option is not flexible at this time. It accepts a column name or None but cannot accept a list of columns at this time. One way to achieve it is to specify None for values and then select columns you want manually.

Loading...
Index(['a', 'b', 'c'], dtype='object', name='id')

pandas.pivot_table

Loading...
Loading...
Loading...