Skip to content

Commit d746d0d

Browse files
author
Christoph Möhl
committed
modified crosstable normalization for multi index data
1 parent 46d711e commit d746d0d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/reshape/pivot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def _normalize(table, normalize, margins, margins_name='All'):
556556
}
557557

558558
elif margins is True:
559-
559+
#skip margin rows and/or cols for normalization
560560
normalizers = {
561561
'all': lambda x: x / x.iloc[:-1,:-1].sum(axis=1).sum(axis=0),
562562
'columns': lambda x: x.div(x.iloc[:-1,:].sum()).iloc[:-1,:],
@@ -573,7 +573,7 @@ def _normalize(table, normalize, margins, margins_name='All'):
573573
except KeyError:
574574
raise ValueError("Not a valid normalize argument")
575575

576-
table=f(table)
576+
table = f(table)
577577
table = table.fillna(0)
578578

579579
return table

0 commit comments

Comments
 (0)