Commit 105ffeb
committed
Fix crosstab(aggfunc='skew') bug
Fix `IndexError` in `crosstab` with `aggfunc=‘skew’`.
* Check if table is empty before accessing last row in `_normalize` function in `pandas/core/reshape/pivot.py`.
* Skip normalization and return empty table if it is.
* Add test case in `pandas/tests/reshape/test_crosstab.py` for `aggfunc=‘skew’`.
* Ensure test case doesn’t raise `IndexError`.1 parent 0a1577f commit 105ffeb
2 files changed
+18
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1144 | 1144 | | |
1145 | 1145 | | |
1146 | 1146 | | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
1147 | 1151 | | |
1148 | 1152 | | |
1149 | 1153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
0 commit comments