From 24ef85092d04dea38216d9c03a6984b1f7839fe5 Mon Sep 17 00:00:00 2001 From: hrishikeshvganu Date: Fri, 21 Aug 2015 21:14:42 +0530 Subject: [PATCH] 'rows' and 'cols' does not work in pd.pivot_table. Modified to 'index' and 'columns' respectively --- code/pandas_lessons.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/pandas_lessons.py b/code/pandas_lessons.py index f60e671..eb49635 100644 --- a/code/pandas_lessons.py +++ b/code/pandas_lessons.py @@ -625,7 +625,7 @@ -#print pd.pivot_table(auto_mpg, values='weight', rows='model', cols='cylinders') +#print pd.pivot_table(auto_mpg, values='weight', index='model', columns='cylinders') # If a cell contains NaN, it means that that combination doesn't exist within the DataFrame. @@ -636,14 +636,14 @@ -#print pd.pivot_table(auto_mpg, values='weight', rows=['model', 'origin'], cols='cylinders') +#print pd.pivot_table(auto_mpg, values='weight', index=['model', 'origin'], columns='cylinders') # You can apply different aggregate functions to a pivot table. Let's look at the total weight per model/cylinder combination. -#print pd.pivot_table(auto_mpg, values='weight', rows='model', cols='cylinders', aggfunc='sum') +#print pd.pivot_table(auto_mpg, values='weight', index='model', columnss='cylinders', aggfunc='sum') # ## Lesson: let's pivot!