Skip to content

Conversation

@jbrockmendel
Copy link
Member

No description provided.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Some hopefully helpful comments. Generally annotating return types would be nice too

_set_value.__doc__ = set_value.__doc__

def _ixs(self, i, axis=0):
def _ixs(self, i: int, axis: int = 0):
Copy link
Member

Choose a reason for hiding this comment

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

Since axis is a pretty common keyword can you put that as Axis in pandas._typing? We probably also want to add str as a type for it since it should accept "index" and "columns" as well

Copy link
Member

Choose a reason for hiding this comment

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

Also can we add the return type here? -> 'DataFrame'?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll take a look and see what we can determine about return types. For Axis/str/int, in all these cases, I've put int because these are private methods and only ever get ints.

if axis is None:
axis = self.axis or 0

def _get_label(self, label, axis: int):
Copy link
Member

Choose a reason for hiding this comment

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

Can label be Hashable?

self.obj._data = self.obj._data.setitem(indexer=indexer, value=value)
self.obj._maybe_update_cacher(clear=True)

def _setitem_with_indexer_missing(self, indexer, value):
Copy link
Member

Choose a reason for hiding this comment

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

Can you annotate this?

Copy link
Member Author

Choose a reason for hiding this comment

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

itd just be Any for both of em. Is that materially better than leaving it blank? In general I prefer to leave it blank rather than put a too-loose type that I'm not sure about

@WillAyd WillAyd added Clean Typing type annotations, mypy/pyright type checking labels Jul 11, 2019
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

looks good. some small changes. ping on green.

def _slice(self, obj, axis=None, kind=None):
if axis is None:
axis = self.axis
def _slice(self, obj, axis: int, kind=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

kind=Optional[str]

self.obj._maybe_update_cacher(clear=True)

def _setitem_with_indexer_missing(self, indexer, value):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a doc-string though

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather not. If I did, it would just say both parameters are object, which may be too loose. I'd rather leave it open for someone to reason about and add a more-correct version.

Copy link
Contributor

Choose a reason for hiding this comment

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

actually I think spitting this into a ndim==1 and a ndim==2 functions would be helpful (future PR ok)

@jreback jreback added this to the 0.25.0 milestone Jul 12, 2019
@jreback
Copy link
Contributor

jreback commented Jul 12, 2019

still would like to move to a unified pandas/core/indexing/..... structure sooner rather than later


maybe_shortcut = False
if hasattr(self, "columns") and isinstance(self.columns, MultiIndex):
if self.ndim == 2 and isinstance(self.columns, MultiIndex):
Copy link
Contributor

Choose a reason for hiding this comment

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

in the future change to use ABCMultiIndex

@jreback
Copy link
Contributor

jreback commented Jul 12, 2019

ok to merge, though if you want to split the setting routine I think might be helpful here.

@jbrockmendel
Copy link
Member Author

though if you want to split the setting routine I think might be helpful here.

will do in next round. lots of balls (branches) in the air

@jreback
Copy link
Contributor

jreback commented Jul 12, 2019

though if you want to split the setting routine I think might be helpful here.

will do in next round. lots of balls (branches) in the air

k

@jreback jreback merged commit c633579 into pandas-dev:master Jul 12, 2019
@jreback
Copy link
Contributor

jreback commented Jul 12, 2019

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Typing type annotations, mypy/pyright type checking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants