Skip to content

TYP: Axis-related annotations #48907

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

Merged
merged 2 commits into from
Oct 3, 2022
Merged

TYP: Axis-related annotations #48907

merged 2 commits into from
Oct 3, 2022

Conversation

twoertwein
Copy link
Member

I tried to limit _typing.AxisInt to Literal[0, 1]. That might be feasible in the future when mypy supports more literal math (e.g., 1 - Literal[0, 1] = Literal[0, 1]), but would cause too many errors for now.

This PR adds a few Axis-related annotations but does not restrict AxisInt to {0, 1}.

data_columns=None,
info=None,
index_axes: list[IndexCol] | None = None,
non_index_axes: list[tuple[AxisInt, Any]] | None = None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intenion was to only change the type here, but I also moved the class-level annotations into __init__.

@twoertwein twoertwein added the Typing type annotations, mypy/pyright type checking label Oct 1, 2022
@mroeschke mroeschke added this to the 1.6 milestone Oct 3, 2022
@mroeschke mroeschke merged commit 5344107 into pandas-dev:main Oct 3, 2022
@mroeschke
Copy link
Member

Thanks @twoertwein

@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
* TYP: Axis-related annotations

* black
@twoertwein twoertwein deleted the axis branch August 9, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants