wearepal / data-science-types

Mypy stubs, i.e., type information, for numpy, pandas and matplotlib
Apache License 2.0
202 stars 51 forks source link

Flesh out pandas and numpy a bit more #168

Closed TheCleric closed 3 years ago

TheCleric commented 4 years ago

This is the result of testing data-science-types against another project I contribute to: https://github.com/jldbc/pybaseball

Everything was done using the latest Pandas docs for reference to data types:

https://pandas.pydata.org/pandas-docs/stable/reference/

I also did my best to add tests to support the changes as well

TheCleric commented 4 years ago

Looks like I'm having a few issues in the github action that I am not having locally:

Please advise.

TheCleric commented 4 years ago

Looks like I'm having a few issues in the github action that I am not having locally:

  • Pandas can accept a re.Pattern in python 3.7+, which I have a version_info check around, but the action is still flagging it.
  • MyPy seems to think the getitem overload I added to _iLocIndexerFrame is superfluous, but my tests fail without it (and I only added it because MyPy was complaining about my code's usage of passing a Tuple[slice, List[str]] to a .loc of a DataFrame, which is valid

Please advise.

Can I get some feedback on fixing these issues so this PR can become mergable?

tmke8 commented 4 years ago

Sorry for the delay! So, let's try to figure out the issues.

Pandas can accept a re.Pattern in python 3.7+, which I have a version_info check around, but the action is still flagging it.

Is it 3.7+ or 3.6+? In the code you wrote if sys.version_info >= (3, 6):. If it was 3.6+, then we can drop the check, because we only support Python >= 3.6 anyway.

TheCleric commented 3 years ago

Sorry for the delay! So, let's try to figure out the issues.

Pandas can accept a re.Pattern in python 3.7+, which I have a version_info check around, but the action is still flagging it.

Is it 3.7+ or 3.6+? In the code you wrote if sys.version_info >= (3, 6):. If it was 3.6+, then we can drop the check, because we only support Python >= 3.6 anyway.

It is 3.7, let me fix that version check.

TheCleric commented 3 years ago

Looks like I was able to fix the first part with using Pattern from typing instead of re.

Now the only thing that remains is the overload issue.

TheCleric commented 3 years ago

🎉 🥳

tmke8 commented 3 years ago

Oh, well done!