Skip to content

TYP: ExtensionArray unique and repeat #41260

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
May 3, 2021
Merged

Conversation

Dr-Irv
Copy link
Contributor

@Dr-Irv Dr-Irv commented May 2, 2021

Typing fixes for ExtensionArray.unique() and ExtensionArray.repeat()

@Dr-Irv Dr-Irv requested a review from simonjayhawkins May 2, 2021 01:39
@simonjayhawkins simonjayhawkins added Typing type annotations, mypy/pyright type checking ExtensionArray Extending pandas with custom dtypes or arrays. labels May 2, 2021
@jreback jreback added this to the 1.3 milestone May 2, 2021
@jbrockmendel
Copy link
Member

jbrockmendel commented May 3, 2021 via email

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented May 3, 2021

Right, my thought is making those Literal would make it more obvious to readers that it is for DataFrame

@jbrockmendel Except that there is no DataFrame.repeat(), so I'm not sure what you mean here.

@jbrockmendel
Copy link
Member

pd._typing.Axis is intended for use in Series/DataFrame methods, not in EA methods. But that is not obvious to all readers (as evidenced by the initial suggestion to use it here). So I was suggesting an edit that might make it clearer to the next reader.

Out of scope for this PR.

@Dr-Irv Dr-Irv requested a review from jreback May 3, 2021 10:39
@jreback
Copy link
Contributor

jreback commented May 3, 2021

as

right my main point here is that we should have exactly 1 canonical way to type things and it should be obvious. If its not it needs lots of comments / expl and is not ideal at all, otherwise we are going to get inconsistencies across the board. if there is a way to enforce this would be great.

in any event this PR is fine.

@jreback jreback merged commit 5ed8e3a into pandas-dev:master May 3, 2021
@Dr-Irv Dr-Irv deleted the unique_repeat branch May 3, 2021 13:00
yeshsurya pushed a commit to yeshsurya/pandas that referenced this pull request May 6, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays. Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants