Commit 290c109
committed
Make px hierarchy sector order deterministic for Polars input
process_dataframe_hierarchy groups each level of the path with group_by,
whose output order is not guaranteed: pandas and PyArrow return groups in
order of first appearance, but Polars returns them in a different order on
every run. Track the original row index, aggregate its minimum per group
and sort each level by it, so that sunburst, treemap and icicle sectors
follow their order of first appearance for all dataframe backends.
Closes #57651 parent 01fe2b8 commit 290c109
3 files changed
Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1958 | 1958 | | |
1959 | 1959 | | |
1960 | 1960 | | |
1961 | | - | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
1962 | 1965 | | |
1963 | 1966 | | |
1964 | 1967 | | |
| |||
1997 | 2000 | | |
1998 | 2001 | | |
1999 | 2002 | | |
| 2003 | + | |
2000 | 2004 | | |
2001 | 2005 | | |
2002 | 2006 | | |
| |||
2049 | 2053 | | |
2050 | 2054 | | |
2051 | 2055 | | |
2052 | | - | |
| 2056 | + | |
2053 | 2057 | | |
2054 | 2058 | | |
2055 | 2059 | | |
| |||
2092 | 2096 | | |
2093 | 2097 | | |
2094 | 2098 | | |
| 2099 | + | |
2095 | 2100 | | |
2096 | 2101 | | |
2097 | 2102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
236 | 262 | | |
237 | 263 | | |
238 | 264 | | |
| |||
0 commit comments