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

Add DataFrame.update_columns #232

Merged

Conversation

MarcoGorelli
Copy link
Contributor

Updating the values in a column is quite inconvenient currently:

idx = df.get_column_names().index(column_names)
df = df.drop_column(column_name)
df = df.insert_column(idx, new_column)

This could be done more simply with

df = df.update_column(new_column)

@MarcoGorelli MarcoGorelli changed the title Add DataFrame.update_column and DataFrame.update_columns Add DataFrame.update_columns Aug 28, 2023
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

Thanks Marco. These methods LGTM to add, should be an improvement for ergonomics.

I'm still getting used to the "no more columns names as keywords", but I think that's probably a good thing.

For the "independent column" requirement I commented on gh-231 already, so let's discuss it there.

spec/API_specification/dataframe_api/dataframe_object.py Outdated Show resolved Hide resolved
@MarcoGorelli
Copy link
Contributor Author

There's no independence requirement for update, it's much simpler: each column must have a different name. Then there's no clashes / ambiguity

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

LGTM now, thanks @MarcoGorelli

@MarcoGorelli
Copy link
Contributor Author

thanks

@MarcoGorelli MarcoGorelli merged commit 3fa0b64 into data-apis:main Aug 29, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants