Skip to content

[REVIEW] Add __setitem__()#2442

Merged
kkraus14 merged 101 commits intorapidsai:branch-0.9from
shwina:add-setitem
Aug 12, 2019
Merged

[REVIEW] Add __setitem__()#2442
kkraus14 merged 101 commits intorapidsai:branch-0.9from
shwina:add-setitem

Conversation

@shwina
Copy link
Copy Markdown
Contributor

@shwina shwina commented Jul 31, 2019

Fixes #1468

Enables setting values of a Series by position or label via s[key] = value, s.iloc[key] = value and s.loc[key] = value. key can be:

  • A scalar value
  • A range of values (utilizes cudf::copy_range)
  • A Series-like of values (utilizes cudf::scatter)
  • A boolean mask (utilizes cudf::scatter)

Adds Series.at and Series.iat as aliases for Series.loc and Series.iloc.

Also enables df.iloc[key] = value and df.loc[key] = value for DataFrames.

Not supported:

  1. Setting rows of a DF
  2. df.loc for dataframes with a MultiIndex

shwina and others added 30 commits July 16, 2019 10:42
@shwina
Copy link
Copy Markdown
Contributor Author

shwina commented Aug 9, 2019

@cwharris Where do you mean?

@cwharris
Copy link
Copy Markdown
Contributor

cwharris commented Aug 9, 2019

@shwina we talked this out in slack, and I got a satisfactory answer that, yes, we're good with depending on Pandas. 👍

Copy link
Copy Markdown
Collaborator

@kkraus14 kkraus14 left a comment

Choose a reason for hiding this comment

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

LGTM, had a few minor comments, but they can be dealt with in followups

@kkraus14 kkraus14 added 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team 4 - Needs cuDF (Python) Reviewer labels Aug 12, 2019
@kkraus14 kkraus14 merged commit 5b3675d into rapidsai:branch-0.9 Aug 12, 2019
wence- added a commit to wence-/cudf that referenced this pull request Oct 11, 2022
To mimic pandas, we must upcast a column to the numpy result_type of
the column itself and the input value dtype. This previously occurred
in all relevant cases except when the index provided to __setitem__
was a single integer (originally introduced in rapidsai#2442). Closes rapidsai#11901.
rapids-bot bot pushed a commit that referenced this pull request Nov 4, 2022
To mimic pandas, we must upcast a column to the numpy result_type of the column itself and the input value dtype. This previously occurred in all relevant cases except when the index provided to __setitem__ was a single integer (originally introduced in #2442). Closes #11901.

Authors:
  - Lawrence Mitchell (https://github.com/wence-)

Approvers:
  - GALI PREM SAGAR (https://github.com/galipremsagar)
  - Bradley Dice (https://github.com/bdice)

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

Labels

5 - Ready to Merge Testing and reviews complete, ready to merge Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEA] Assignment by index

7 participants