📖 INDEX
LOADING ENGINE...
pd.pivot_table()
AI & DATA SCIENCE // pd-pivot-table
Create a spreadsheet-style pivot table as a DataFrame.
Syntax
pt = pd.pivot_table(df, values='D', index=['A', 'B'], columns=['C'], aggfunc=np.sum)Examples
Example 01Basic Usage
pt = pd.pivot_table(df, values='D', index=['A', 'B'], columns=['C'], aggfunc=np.sum)Best Practices
- Use vectorized operations over iterations (e.g.
iterrows()) for performance. - Always verify memory usage when loading large files.