Skip to content
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

Fix Series.setitem #13888

Closed
wants to merge 3 commits into from
Closed

Conversation

galipremsagar
Copy link
Contributor

Description

Fixes: #13860

This PR is WIP.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Comment on lines +303 to +311
if isinstance(self._frame.index, cudf.RangeIndex):
new_idx = _try_append_to_range_index(self._frame.index, key)
if new_idx is not None:
self._frame._index = new_idx
else:
self._frame.index = self._frame.index._as_int_index()
_append_new_row_inplace(self._frame.index._values, key)
else:
_append_new_row_inplace(self._frame.index._values, key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to note (and this is not a new bug). It's unsafe to append to an index inplace, since indices are immutable, so they are allowed to be shared. Witness:

import cudf
s = cudf.Series([1], index=[7])
s2 = cudf.Series([2], index=s.index) # safe because indices are immutable

s.loc[11] = 2 # uh-oh, we lied about immutability
print(s2) # this breaks because the index is too long

@galipremsagar galipremsagar changed the base branch from branch-23.10 to branch-23.12 November 7, 2023 21:39
@vyasr
Copy link
Contributor

vyasr commented Jan 23, 2024

The underlying issue was resolved in 66fdbe7

@vyasr vyasr closed this Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[BUG] Series.__setitem__ that expands is not displayable
3 participants