Skip to content

Commit cafa8fd

Browse files
authored
rename insert, remove label argument (#230)
1 parent 192901a commit cafa8fd

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,24 @@ def get_rows_by_mask(self, mask: Column[Bool]) -> DataFrame:
180180
"""
181181
...
182182

183-
def insert(self, loc: int, label: str, value: Column[Any]) -> DataFrame:
183+
def insert_column(self, loc: int, column: Column[Any]) -> DataFrame:
184184
"""
185185
Insert column into DataFrame at specified location.
186186
187+
The column's name will be used as the label in the resulting dataframe.
188+
To insert the column with a different name, combine with `Column.rename`,
189+
e.g.:
190+
191+
.. code-block :: python
192+
193+
new_column = df.get_column_by_name('a') + 1
194+
df = df.insert(0, new_column.rename('a_plus_1'))
195+
187196
Parameters
188197
----------
189198
loc : int
190199
Insertion index. Must verify 0 <= loc <= len(columns).
191-
label : str
192-
Label of the inserted column.
193-
value : Column
200+
column : Column
194201
"""
195202
...
196203

0 commit comments

Comments
 (0)