Use group_by(maintain_order=True) in process_dataframe_hierarchy once narwhals exposes it
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 65/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
阅读 plotly/express/_core.py 中的 process_dataframe_hierarchy,并确认最低版本的 narwhals 在 group_by 上提供 maintain_order。使用 test_sunburst_treemap_with_path_order 作为回归检查;完成的标准是临时排序机制已移除、测试仍然通过,并且基于路径的 sunburst、treemap 和 icicle 排序仍保持确定性。
由索引模型根据 Issue 内容生成。
描述
Description
process_dataframe_hierarchy (plotly/express/_core.py), which builds the data for px.sunburst, px.treemap and px.icicle when path is used, adds a temporary row index column, aggregates its minimum per group and sorts each level by it. This is there only to get a deterministic sector order out of group_by, whose row order is not guaranteed for every backend (#5765, #5766).
narwhals is planning to expose maintain_order on group_by (narwhals-dev/narwhals#3309). Once that lands and the minimum supported narwhals version in pyproject.toml includes it, the temporary column, its aggregation and the per-level sort can be dropped in favour of df.group_by(path[i:], drop_null_keys=True, maintain_order=True).
The existing test_sunburst_treemap_with_path_order test covers the behaviour, so it should keep passing after the switch.
Filed as a follow up to #5766, as suggested by @camdecoster in #5765.
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 13 小时 41 分钟
- 30 天内合并 PR
- 21
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/plotly.py 的其他 Issue
-
P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 72/100
-
bug P1
难度 1/5 1 小时以内 新手友好度 68/100
-
feature P3
难度 2/5 1-3 小时 新手友好度 62/100
-
feature P3
难度 2/5 1-3 小时 新手友好度 72/100
-
bug P1 size: 1
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
canonical/paas-charm#368 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
tech debt
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 90/100
StevenBlack/hosts#3256 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
qualcomm/qai-appbuilder#275 ·