data-science-types icon indicating copy to clipboard operation
data-science-types copied to clipboard

Missing Pandas types: dataframe.index.names, columns.names, read_*, assignments, starts with

Open richtong opened this issue 4 years ago • 4 comments

If of all thanks so much for doing this typing library. I use nptyping and we were trying your data-science-types. Here are the types that are missing. I'm no .pyi expert, but happy to help, so in our project here is what is not working and should all exist, in looking at the pyi files

I can see the errors, because index is just an array, but it actually has the name property

Pandas.DataFrame.index.name Pandas.DataFrame.columns.name Panda.read_hdf, read_html, read_excel, to_hdf Pandas dataframe can't accept assignment Pandas.columns can't be assigned Pandas.dropna missing Pandas.to_replace missing Pandas.replace Pandas.startwith Pandas.string.startswith Pandas dataframe cannot be used as a left operand

Numpy problems

Numpy.ones_like= Numpy.einsum numpy.array doesn't handle the pass of a dataframe as an input (which works btw) numpy.any not available

Would you consider removing your numpy types and letting nptyping handle that. There does not seem to be a good way to interoperate conflicting.pyi

richtong avatar Jul 31 '20 01:07 richtong

hmmmm... Interesting question about removing numpy types. I'll have to talk to @thomkeh about it. I can't see us just removing support for numpy - that's not something we've thought about at all, and I'd be surprised if we go that way, I imagine it would cause more problems overall than it solves. Maybe we could have some way of only installing pandas type hints..... I'll have to look into it

Regarding missing pandas type hints, if you have time, please feel free to open a PR with these (or a subset) added, we're happy to help you either get started, or help wrangle some of the trickier parts of typing (if you come across them - these aren't that common). Alternatively, if you don't have time, I understand - let me know and I'll add these to the backlog.

Cheers - and welcome aboard! Oliver

olliethomas avatar Aug 03 '20 08:08 olliethomas

We could split the library into a part for numpy and a part for pandas.

If nptyping is a full replacement for our numpy type stubs, then I would likely stop working on our type stubs.

tmke8 avatar Aug 03 '20 08:08 tmke8

I just had a look at nptyping and it doesn't seem to define any type stubs for numpy functions (there are no .pyi in their repository). Where did you observe conflicts?

tmke8 avatar Aug 03 '20 08:08 tmke8

It doesn't appear as if this is the intention of the nptyping library

https://github.com/ramonhagenaars/nptyping/issues/34

TheCleric avatar Sep 19 '20 17:09 TheCleric