jorisvandenbossche commented on code in PR #33810: URL: https://github.com/apache/arrow/pull/33810#discussion_r1086495953
########## python/pyarrow/table.pxi: ########## @@ -4708,6 +4711,61 @@ cdef class Table(_PandasConvertible): return table + def drop(self, columns): + """ + Drop one or more columns and return a new table. + + Alias of Table.drop_columns for backwards compatibility. + + Parameters + ---------- + columns : str or list[str] + Field name(s) referencing existing column(s). + + Raises + ------ + KeyError + If any of the passed column names do not exist. + + Returns + ------- + Table + New table without the column(s). + + Warnings + -------- + This API is depreacted in favor of Table.drop_columns. + + Examples + -------- + >>> import pyarrow as pa + >>> import pandas as pd + >>> df = pd.DataFrame({'n_legs': [2, 4, 5, 100], + ... 'animals': ["Flamingo", "Horse", "Brittle stars", "Centipede"]}) + >>> table = pa.Table.from_pandas(df) + + Drop one column: + + >>> table.drop("animals") + pyarrow.Table + n_legs: int64 + ---- + n_legs: [[2,4,5,100]] + + Drop one or more columns: + + >>> table.drop(["n_legs", "animals"]) + pyarrow.Table + ... + ---- + """ + import warnings + warnings.warn( + "Table.drop is deprecated, use Table.drop_columns.", + DeprecationWarning) Review Comment: ```suggestion "Table.drop is deprecated, use Table.drop_columns.", DeprecationWarning, stacklevel=2) ``` (to ensure the warning points to where the method is actually used and not to this location) ########## python/pyarrow/table.pxi: ########## @@ -4708,6 +4711,61 @@ cdef class Table(_PandasConvertible): return table + def drop(self, columns): + """ + Drop one or more columns and return a new table. + + Alias of Table.drop_columns for backwards compatibility. + + Parameters Review Comment: Either way if we just keep it as alias or actively deprecate it, I think it's also fine to only keep the docstring up to here, saying it is an alias, and then refer to the docstring of `drop_columns` for more details. That avoids duplicating the rest of the content. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org