-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: simplify _sanitize_column #38459
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
pandas/core/frame.py
Outdated
@@ -3210,15 +3212,47 @@ def _setitem_frame(self, key, value): | |||
self._check_setitem_copy() | |||
self._where(-key, value, inplace=True) | |||
|
|||
def _set_item_frame_value(self, key, value: "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.
add return type (None)
pandas/core/frame.py
Outdated
# reindex if necessary | ||
|
||
if value.index.equals(index) or not len(index): | ||
value = value._values.copy() |
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.
can you just return here?
pandas/core/frame.py
Outdated
else: | ||
|
||
# GH#4107 | ||
try: |
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.
avoids nesting this
return value | ||
|
||
|
||
def _maybe_atleast_2d(value): |
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.
can likley use elsewhere
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.
could put in core/dtypes/cast
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.
ill take a look; most likely place it would be used is in internals
thanks, yeah we have a lot of built up code over the years. +1 on organizaing / simplifying. |
It gets called indirectly from
iloc._setitem_with_indexer
, which we're trying to simplify