Skip to content

TYP: npt.NDarray #42488

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
Jul 14, 2021
Merged

TYP: npt.NDarray #42488

merged 2 commits into from
Jul 14, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

cc @simonjayhawkins

@@ -15,6 +15,7 @@
from warnings import warn

import numpy as np
import numpy.typing as npt
Copy link
Member

Choose a reason for hiding this comment

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

import npt from pandas._typing (it is guarded). but ok to use import numpy.typing as npt in stubs.

def get_compressed_ids(labels, sizes: Shape) -> tuple[np.ndarray, np.ndarray]:
def get_compressed_ids(
labels, sizes: Shape
) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.int64]]:
Copy link
Member

Choose a reason for hiding this comment

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

according to docstring

Suggested change
) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.int64]]:
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.int64]]:

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Jul 12, 2021
@jreback jreback added this to the 1.4 milestone Jul 13, 2021
@simonjayhawkins simonjayhawkins merged commit 2001798 into pandas-dev:master Jul 14, 2021
@simonjayhawkins
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the typ-intp branch July 14, 2021 15:15
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
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.

3 participants