-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
[WIP] Annotate DataFrame (Part 3) #28575
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
Conversation
""" | ||
Returns length of info axis, but here we use the index. | ||
""" | ||
return len(self.index) | ||
|
||
def dot(self, other): | ||
def dot(self, other: Union[Series, DataFrame]) -> Union[Series, DataFrame]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should include np.ndarray
in the signature here. Applicable to the rest below as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright.
Added some types without paying much attention, will take a closer later.
Btw I am guessing if type of other
is Series
, return type will be Series
too, similar for DataFrame
and np.ndarray
, how do I indicate that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A TypeVar would make the function generic (i.e. the return type would match other
if the same TypeVar is used for both) but unfortunately I don't think that is how this is actually implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, pretty sure saw something like that in the docstring. But did this in a hurry(thats why draft PR), a bit busy. Will take a closer look as soon as I can.
closed as stale. @vaibhavhrt ping if you wish to continue. |
Sorry been really busy last few weeks. Will be busy next few days as well,
but I do wish to continue and complete it, just give me a few days I will
reopen the PR.
…On Mon, 21 Oct, 2019, 1:54 PM Simon Hawkins, ***@***.***> wrote:
closed as stale. @vaibhavhrt <https://github.com/vaibhavhrt> ping if you
wish to continue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#28575?email_source=notifications&email_token=AFMJMLAM5YV36L7DKU5MNITQPVRNPA5CNFSM4IZHCCMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBZPMKA#issuecomment-544405032>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFMJMLE5JRIIZWAABGYVX6LQPVRNPANCNFSM4IZHCCMA>
.
|
removing from draft, otherwise I keep forgetting about it. Will try it get it done fast now. |
@@ -23,6 +23,7 @@ | |||
from pandas.core.indexes.base import Index # noqa: F401 | |||
from pandas.core.series import Series # noqa: F401 | |||
from pandas.core.generic import NDFrame # noqa: F401 | |||
from pandas.io.formats.style import Styler # noqa: F401 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just put this in a if TYPE_CHECKING
block in pandas.core.frame instead of here
@@ -4631,7 +4631,7 @@ def drop_duplicates(self, subset=None, keep="first", inplace=False): | |||
duplicated = self.duplicated(subset, keep=keep) | |||
|
|||
if inplace: | |||
(inds,) = (-duplicated)._ndarray_values.nonzero() | |||
inds = (-duplicated)._ndarray_values.nonzero()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this required for mypy? If not can you revert?
closing as stale, ping if you want to continue. |
I can help out here, I really want to see type checking with a df. |
@stangirala this PR specifically is stale; if you have contributions you'd like to make for that feel free to push a separate PR |
@WillAyd can I use this PR as a template? |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff