Skip to content

Conversation

jbrockmendel
Copy link
Member

It gets called indirectly from iloc._setitem_with_indexer, which we're trying to simplify

self._check_setitem_copy()
self._where(-key, value, inplace=True)

def _set_item_frame_value(self, key, value: "DataFrame"):
Copy link
Contributor

Choose a reason for hiding this comment

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

add return type (None)

# reindex if necessary

if value.index.equals(index) or not len(index):
value = value._values.copy()
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 just return here?

else:

# GH#4107
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

avoids nesting this

return value


def _maybe_atleast_2d(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 likley use elsewhere

Copy link
Contributor

Choose a reason for hiding this comment

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

could put in core/dtypes/cast

Copy link
Member Author

Choose a reason for hiding this comment

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

ill take a look; most likely place it would be used is in internals

@jreback jreback added Refactor Internal refactoring of code Indexing Related to indexing on series/frames, not to indexes themselves labels Dec 14, 2020
@jreback jreback added this to the 1.3 milestone Dec 14, 2020
@jreback jreback merged commit 35cc565 into pandas-dev:master Dec 14, 2020
@jreback
Copy link
Contributor

jreback commented Dec 14, 2020

thanks, yeah we have a lot of built up code over the years. +1 on organizaing / simplifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants