@@ -402,12 +402,12 @@ We can produce pivot tables from this data very easily:
402
402
.. ipython :: python
403
403
404
404
pd.pivot_table(df, values = " D" , index = [" A" , " B" ], columns = [" C" ])
405
- pd.pivot_table(df, values = " D" , index = [" B" ], columns = [" A" , " C" ], aggfunc = np. sum)
405
+ pd.pivot_table(df, values = " D" , index = [" B" ], columns = [" A" , " C" ], aggfunc = " sum" )
406
406
pd.pivot_table(
407
407
df, values = [" D" , " E" ],
408
408
index = [" B" ],
409
409
columns = [" A" , " C" ],
410
- aggfunc = np. sum,
410
+ aggfunc = " sum" ,
411
411
)
412
412
413
413
The result object is a :class: `DataFrame ` having potentially hierarchical indexes on the
@@ -451,7 +451,7 @@ rows and columns:
451
451
columns = " C" ,
452
452
values = [" D" , " E" ],
453
453
margins = True ,
454
- aggfunc = np. std
454
+ aggfunc = " std"
455
455
)
456
456
table
457
457
@@ -552,7 +552,7 @@ each group defined by the first two :class:`Series`:
552
552
553
553
.. ipython :: python
554
554
555
- pd.crosstab(df[" A" ], df[" B" ], values = df[" C" ], aggfunc = np. sum)
555
+ pd.crosstab(df[" A" ], df[" B" ], values = df[" C" ], aggfunc = " sum" )
556
556
557
557
Adding margins
558
558
~~~~~~~~~~~~~~
@@ -562,7 +562,7 @@ Finally, one can also add margins or normalize this output.
562
562
.. ipython :: python
563
563
564
564
pd.crosstab(
565
- df[" A" ], df[" B" ], values = df[" C" ], aggfunc = np. sum, normalize = True , margins = True
565
+ df[" A" ], df[" B" ], values = df[" C" ], aggfunc = " sum" , normalize = True , margins = True
566
566
)
567
567
568
568
.. _reshaping.tile :
0 commit comments