C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Pandas DataFrame.pivot_table()The Pandas pivot_table() is used to calculate, aggregate, and summarize your data. It is defined as a powerful tool that aggregates data with calculations such as Sum, Count, Average, Max, and Min. It also allows the user to sort and filter your data when the pivot table has been created. Parameters:
If we pass an array, it must be of the same length as data.
If we pass an array, it must be of the same length as data.
Returns:It returns a DataFrame as the output. Example:# importing pandas as pd import pandas as pd import numpy as np # create dataframe info = pd.DataFrame({'P': ['Smith', 'John', 'William', 'Parker'], 'Q': ['Python', 'C', 'C++', 'Java'], 'R': [19, 24, 22, 25]}) info table = pd.pivot_table(info, index =['P', 'Q']) table Output P Q R John C 24 Parker Java 25 Smith Python 19 William C 22
Next TopicDataFrame.query()
|