Skip to content

Commit

Permalink
Bring in upstream series binary operation fix 6d5545f… (modin-project#52
Browse files Browse the repository at this point in the history
)

* Bring in upstream series binary operation fix 6d5545f.

Signed-off-by: mvashishtha <[email protected]>

* Update modin/pandas/series.py

Co-authored-by: Karthik Velayutham <[email protected]>

---------

Signed-off-by: mvashishtha <[email protected]>
Co-authored-by: Karthik Velayutham <[email protected]>
  • Loading branch information
mvashishtha and pyrito authored Jan 30, 2023
1 parent 2992548 commit a0b049d
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions modin/pandas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,9 @@ def truncate(
"""
Truncate a Series before and after some index value.
"""
return self.__constructor__(self.__query_compiler__.truncate(before, after, axis, copy))
return self.__constructor__(
self.__query_compiler__.truncate(before, after, axis, copy)
)

def unique(self): # noqa: RT01, D200
"""
Expand Down Expand Up @@ -2334,12 +2336,15 @@ def _prepare_inter_op(self, other):
Prepared `other`.
"""
if isinstance(other, Series):
# NB: deep=False is important for performance bc it retains obj.index._id
new_self = self.copy(deep=False)
new_other = other.copy(deep=False)
if self.name == other.name:
new_self.name = new_other.name = self.name
else:
names_different = self.name != other.name
# NB: if we don't need a rename, do the interaction with shallow
# copies so that we preserve obj.index._id. It's fine to work
# with shallow copies because we'll discard the copies but keep
# the result after the interaction operation. We can't do a rename
# on shallow copies because we'll mutate the original objects.
new_self = self.copy(deep=names_different)
new_other = other.copy(deep=names_different)
if names_different:
new_self.name = new_other.name = MODIN_UNNAMED_SERIES_LABEL
else:
new_self = self
Expand Down

0 comments on commit a0b049d

Please sign in to comment.