Commit 8667459
committed
Fix pivot_table corruption with large datasets in Python 3.14
This commit addresses issue GH#63314 where pivot_table operations
on large datasets produce corrupted output with duplicate index
values when running on Python 3.14.
The root cause appears to be changes in Python 3.14's hashtable
implementation or dictionary behavior. The compress_group_index
function was relying on Int64HashTable.get_labels_groupby() which
produces incorrect results for large datasets in Python 3.14.
The fix uses a numpy-based approach for Python 3.14+ that:
- Explicitly sorts the group_index when needed
- Uses numpy operations to identify unique values
- Maps compressed IDs back to original order
- Preserves the existing hashtable-based path for older Python versions
Added regression test to ensure pivot_table correctly handles
large datasets without producing duplicate indices.1 parent 499c5d4 commit 8667459
2 files changed
+67
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
683 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
684 | 687 | | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
685 | 702 | | |
686 | | - | |
| 703 | + | |
687 | 704 | | |
688 | | - | |
689 | | - | |
690 | | - | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
691 | 715 | | |
692 | 716 | | |
693 | 717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2959 | 2959 | | |
2960 | 2960 | | |
2961 | 2961 | | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
0 commit comments