-
-
Notifications
You must be signed in to change notification settings - Fork 143
CLEAN: Resolve Axis and AxisType #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Now I think there is only a single place where |
The issue is that within the stubs themselves we have many places where we use |
yeah i'll do it |
Actually i am not able to understand what is to be done with |
In AxisInt: TypeAlias = Literal[0, 1]
Axis: TypeAlias = AxisInt | Literal["index", "columns", "rows"]
SeriesAxisType: TypeAlias = Literal[
"index", 0
] # Restricted subset of _AxisType for series
AxisTypeIndex: TypeAlias = Literal["index", 0]
AxisTypeColumn: TypeAlias = Literal["columns", 1]
AxisType: TypeAlias = AxisTypeIndex | AxisTypeColumn In the pandas source, we use Based on a discussion in pandas-dev/pandas#48612 , I'd like @twoertwein to comment on which way he thinks we should go within |
I like the idea of separating Series-only/DataFrame axis values! Making that change in pandas will probably take some effort (especially for the integer indexing). I'm slightly shocked how many Axis-related types we have, can we simplify it a bit. Maybe: AxisInt: TypeAlias = Literal[0, 1] # might not even be needed for the public API, typically used in private functions
AxisIndex: TypeAlias = Literal["index", 0]
AxisColumn: TypeAlias = Literal["columns", 1]
Axis: TypeAlias = AxisTypeIndex | AxisTypeColumn |
What about including "rows" in |
the pandas PR added it only because it is technically possible and to avoid a mypy error (but I think it is not very well documented/used). I'd be fine adding/excluding it. |
@ramvikrams AxisInt: TypeAlias = Literal[0, 1] # might not even be needed for the public API, typically used in private functions
AxisIndex: TypeAlias = Literal["index", 0]
AxisColumn: TypeAlias = Literal["columns", 1]
Axis: TypeAlias = AxisTypeIndex | AxisTypeColumn and remove We can remove So that would mean we would only see |
thanks, i'll get started now |
We don't have |
Yes, the goal is to use what is now |
In
_typing.pyi
, we have:There are 23 places (assuming I did
grep
correctly) where we useAxis
, but can probably change this toAxisType
in many (if not all) of them.The text was updated successfully, but these errors were encountered: