ENH: IDEA Introduce axis→0/axis→1 arrow aliases to disambiguate direction vs. label operations #61336
Closed
1 of 3 tasks
Labels
Closing Candidate
May be closeable, needs more eyeballs
Enhancement
Needs Discussion
Requires discussion from core team before further action
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
The `axis` parameter currently serves two distinct purposes:apply
,sum
)drop
,rename
)Because both use the same syntax (
axis=0
oraxis=1
), many users mis‑interpret which dimension is affected.<한국어>
현재 axis 매개변수는 서로 다른 두 가지 목적으로 사용되고 있습니다:
값을 축소하거나 변환하는 축 방향 연산 (예: apply, sum)
인덱스/열 레이블을 수정하거나 삭제하는 레이블 대상 연산 (예: drop, rename)
두 경우 모두 동일한 구문(axis=0 또는 axis=1)을 사용하기 때문에 많은 사용자가 어떤 차원이 영향을 받는지 혼동합니다.
Feature Description
Proposed API Keep existing syntax and add an **arrow alias** that makes the “direction” explicit:axis=0
(unchanged)axis=1
(unchanged)axis→0
(new)axis→1
(new)Arrow aliases are optional; existing code keeps working unchanged.
<한국어>
제안된 API
기존 구문을 유지하면서 "방향"을 명확히 나타내는 화살표 별칭을 추가합니다
axis=0
(변경없음)axis=1
(변경없음)axis→0
(신규)axis→1
(신규)화살표 별칭은 선택 사항이며, 기존 코드는 변경 없이 계속 작동합니다.
Alternative Solutions
axis→0
axis→1
Benefits
axis
.axis_aliases
).<한국어>
axis→0
axis→1
장점
axis에 대한 초보자의 혼란을 크게 줄입니다.
NumPy 호환성을 완전히 유지합니다.
최소한의 코드 변경만 필요합니다 (axis_aliases에 별칭 매핑 추가).
Additional Context
See repeated questions on Stack Overflow:
https://stackoverflow.com/q/26716616.
The text was updated successfully, but these errors were encountered: