Skip to content

Commit f6f41de

Browse files
committed
remove loc
1 parent f343f1d commit f6f41de

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ def insert_column(self, column: Column[Any]) -> DataFrame:
209209
"""
210210
...
211211

212-
def insert_columns(self, locs_and_columns: Sequence[tuple[int, Column[Any]]]) -> DataFrame:
212+
def insert_columns(self, columns: Sequence[Column[Any]]) -> DataFrame:
213213
"""
214-
Insert columns into DataFrame at specified locations.
214+
Insert columns into DataFrame at rightmost location.
215215
216216
Like :meth:`insert_column`, but can insert multiple (independent) columns.
217217
Some implementations may be able to make use of parallelism in this
@@ -220,9 +220,9 @@ def insert_columns(self, locs_and_columns: Sequence[tuple[int, Column[Any]]]) ->
220220
.. code-block::
221221
222222
new_column = df.get_column_by_name('a') + 1
223-
df = df.insert_column(0, new_column.rename('a_plus_1'))
223+
df = df.insert_column(new_column.rename('a_plus_1'))
224224
new_column = df.get_column_by_name('b') + 1
225-
df = df.insert_column(1, new_column.rename('b_plus_1'))
225+
df = df.insert_column(new_column.rename('b_plus_1'))
226226
227227
it would be better to write
228228
@@ -232,21 +232,21 @@ def insert_columns(self, locs_and_columns: Sequence[tuple[int, Column[Any]]]) ->
232232
new_column_1 = df.get_column_by_name('b') + 1
233233
df = df.insert_columns(
234234
[
235-
(0, new_column_0.rename('a_plus_1')),
236-
(1, new_column_1.rename('b_plus_1')),
235+
new_column_0.rename('a_plus_1'),
236+
new_column_1.rename('b_plus_1'),
237237
]
238238
)
239239
240240
so that insertion can happen in parallel for some implementations.
241241
242242
Parameters
243243
----------
244-
locs_and_columns : Sequence[Tuple[int, Column]]
245-
Sequence of tuples of the kind (location, column).
244+
columns : Sequence[Column]
245+
Sequence of `Column`s.
246246
Must be independent of each other.
247-
Locations and column names must be unique.
247+
Column names must be unique.
248248
Column names may not already be present in the
249-
dataframe - use `DataFrame.rename` to rename them
249+
dataframe - use :meth:`Column.rename` to rename them
250250
beforehand if necessary.
251251
252252
Returns

0 commit comments

Comments
 (0)