Skip to content

Add DataFrame.update_columns #232

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,31 @@ def insert_column(self, loc: int, column: Column[Any]) -> DataFrame:
"""
...

def update_columns(self, columns: Column[Any] | Sequence[Column[Any]], /) -> DataFrame:
"""
Update values in existing column(s) from Dataframe.

The column's name will be used to tell which column to update.
To update a column with a different name, combine with :meth:`Column.rename`,
e.g.:

.. code-block:: python

new_column = df.get_column_by_name('a') + 1
df = df.update_column(new_column.rename('b'))

Parameters
----------
columns : Column | Sequence[Column]
Column(s) to update. If updating multiple columns, they must all have
different names.

Returns
-------
DataFrame
"""
...

def drop_column(self, label: str) -> DataFrame:
"""
Drop the specified column.
Expand Down