Skip to content
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
15 changes: 11 additions & 4 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,24 @@ def get_rows_by_mask(self, mask: Column[Bool]) -> DataFrame:
"""
...

def insert(self, loc: int, label: str, value: Column[Any]) -> DataFrame:
def insert_column(self, loc: int, column: Column[Any]) -> DataFrame:
"""
Insert column into DataFrame at specified location.

The column's name will be used as the label in the resulting dataframe.
To insert the column with a different name, combine with `Column.rename`,
e.g.:

.. code-block :: python

new_column = df.get_column_by_name('a') + 1
df = df.insert(0, new_column.rename('a_plus_1'))

Parameters
----------
loc : int
Insertion index. Must verify 0 <= loc <= len(columns).
label : str
Label of the inserted column.
value : Column
column : Column
"""
...

Expand Down