Skip to content

TYP: type annotations for nancorr #44227

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 1 commit into from
Oct 29, 2021

Conversation

simonjayhawkins
Copy link
Member

No description provided.

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Oct 29, 2021
@simonjayhawkins simonjayhawkins added this to the 1.4 milestone Oct 29, 2021
cov: bool = ...,
minp=...,
) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
minp: int | 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.

we may pass None from pandas/core/frame.py:9667. base_cov = libalgos.nancorr(mat, cov=True, minp=min_periods)

In nancorr_spearman we don't allow None, if not specified, the default is 1, specified in the function signature.

The default is also 1 in nancorr, coded if None which is the signature default.

Not sure whether this inconsistency is a big deal.

Copy link
Contributor

Choose a reason for hiding this comment

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

could open an issue about this

minp: int = ...,
) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
def nancorr_kendall(
Copy link
Member Author

Choose a reason for hiding this comment

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

this was removed in #43403

Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

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

LGTM

mat: np.ndarray, # ndarray[float64_t, ndim=2]
minp: int = ...,
) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
) -> npt.NDArray[np.float64]: ... # ndarray[float64_t, ndim=2]
Copy link
Member

Choose a reason for hiding this comment

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

have you heard anything about if/when/how npt.NDArray is going to support something equivalent to ndim=2?

@jreback jreback merged commit 66a1e92 into pandas-dev:master Oct 29, 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