@@ -775,7 +775,7 @@ def has_column(self, name: str) -> bool:
775775
776776 def remove_columns (
777777 self ,
778- names : str | list [str ],
778+ selector : str | list [str ],
779779 * ,
780780 ignore_unknown_names : bool = False ,
781781 ) -> Table :
@@ -786,8 +786,8 @@ def remove_columns(
786786
787787 Parameters
788788 ----------
789- names :
790- The names of the columns to remove.
789+ selector :
790+ The columns to remove.
791791 ignore_unknown_names:
792792 If set to True, columns that are not present in the table will be ignored.
793793 If set to False, an error will be raised if any of the specified columns do not exist.
@@ -831,18 +831,18 @@ def remove_columns(
831831 Related
832832 -------
833833 - [select_columns][safeds.data.tabular.containers._table.Table.select_columns]:
834- Keep only a subset of the columns. This method accepts either column names, or a predicate.
834+ Keep only a subset of the columns.
835835 - [remove_columns_with_missing_values][safeds.data.tabular.containers._table.Table.remove_columns_with_missing_values]
836836 - [remove_non_numeric_columns][safeds.data.tabular.containers._table.Table.remove_non_numeric_columns]
837837 """
838- if isinstance (names , str ):
839- names = [names ]
838+ if isinstance (selector , str ):
839+ selector = [selector ]
840840
841841 if not ignore_unknown_names :
842- _check_columns_exist (self , names )
842+ _check_columns_exist (self , selector )
843843
844844 return Table ._from_polars_lazy_frame (
845- self ._lazy_frame .drop (names , strict = not ignore_unknown_names ),
845+ self ._lazy_frame .drop (selector , strict = not ignore_unknown_names ),
846846 )
847847
848848 def remove_columns_with_missing_values (
@@ -900,7 +900,7 @@ def remove_columns_with_missing_values(
900900 - [KNearestNeighborsImputer][safeds.data.tabular.transformation._k_nearest_neighbors_imputer.KNearestNeighborsImputer]:
901901 Replace missing values with a value computed from the nearest neighbors.
902902 - [select_columns][safeds.data.tabular.containers._table.Table.select_columns]:
903- Keep only a subset of the columns. This method accepts either column names, or a predicate.
903+ Keep only a subset of the columns.
904904 - [remove_columns][safeds.data.tabular.containers._table.Table.remove_columns]:
905905 Remove columns from the table by name.
906906 - [remove_non_numeric_columns][safeds.data.tabular.containers._table.Table.remove_non_numeric_columns]
@@ -955,7 +955,7 @@ def remove_non_numeric_columns(self) -> Table:
955955 Related
956956 -------
957957 - [select_columns][safeds.data.tabular.containers._table.Table.select_columns]:
958- Keep only a subset of the columns. This method accepts either column names, or a predicate.
958+ Keep only a subset of the columns.
959959 - [remove_columns][safeds.data.tabular.containers._table.Table.remove_columns]:
960960 Remove columns from the table by name.
961961 - [remove_columns_with_missing_values][safeds.data.tabular.containers._table.Table.remove_columns_with_missing_values]
@@ -1113,21 +1113,17 @@ def replace_column(
11131113
11141114 def select_columns (
11151115 self ,
1116- selector : str | list [str ] | Callable [[ Column ], bool ] ,
1116+ selector : str | list [str ],
11171117 ) -> Table :
11181118 """
11191119 Select a subset of the columns and return the result as a new table.
11201120
1121- **Notes:**
1122-
1123- - The original table is not modified.
1124- - If the `selector` is a custom function, this operation must fully load the data into memory, which can be
1125- expensive.
1121+ **Note:** The original table is not modified.
11261122
11271123 Parameters
11281124 ----------
11291125 selector:
1130- The names of the columns to keep, or a predicate that decides whether to keep a column .
1126+ The columns to keep.
11311127
11321128 Returns
11331129 -------
@@ -1161,23 +1157,11 @@ def select_columns(
11611157 - [remove_columns_with_missing_values][safeds.data.tabular.containers._table.Table.remove_columns_with_missing_values]
11621158 - [remove_non_numeric_columns][safeds.data.tabular.containers._table.Table.remove_non_numeric_columns]
11631159 """
1164- import polars as pl
1165-
1166- # Select by predicate
1167- if callable (selector ):
1168- return Table ._from_polars_lazy_frame (
1169- pl .LazyFrame (
1170- [column ._series for column in self .to_columns () if selector (column )],
1171- ),
1172- )
1173-
1174- # Select by column names
1175- else :
1176- _check_columns_exist (self , selector )
1160+ _check_columns_exist (self , selector )
11771161
1178- return Table ._from_polars_lazy_frame (
1179- self ._lazy_frame .select (selector ),
1180- )
1162+ return Table ._from_polars_lazy_frame (
1163+ self ._lazy_frame .select (selector ),
1164+ )
11811165
11821166 def transform_columns (
11831167 self ,
@@ -1611,7 +1595,7 @@ def remove_rows_by_column(
16111595 def remove_rows_with_missing_values (
16121596 self ,
16131597 * ,
1614- column_names : str | list [str ] | None = None ,
1598+ selector : str | list [str ] | None = None ,
16151599 ) -> Table :
16161600 """
16171601 Remove rows that contain missing values in the specified columns and return the result as a new table.
@@ -1624,8 +1608,8 @@ def remove_rows_with_missing_values(
16241608
16251609 Parameters
16261610 ----------
1627- column_names :
1628- The names of the columns to check. If None, all columns are checked.
1611+ selector :
1612+ The columns to check. If None, all columns are checked.
16291613
16301614 Returns
16311615 -------
@@ -1645,7 +1629,7 @@ def remove_rows_with_missing_values(
16451629 | 1 | 4 |
16461630 +-----+-----+
16471631
1648- >>> table.remove_rows_with_missing_values(column_names =["b"])
1632+ >>> table.remove_rows_with_missing_values(selector =["b"])
16491633 +------+-----+
16501634 | a | b |
16511635 | --- | --- |
@@ -1669,18 +1653,18 @@ def remove_rows_with_missing_values(
16691653 - [remove_duplicate_rows][safeds.data.tabular.containers._table.Table.remove_duplicate_rows]
16701654 - [remove_rows_with_outliers][safeds.data.tabular.containers._table.Table.remove_rows_with_outliers]
16711655 """
1672- if isinstance (column_names , list ) and not column_names :
1656+ if isinstance (selector , list ) and not selector :
16731657 # polars panics in this case
16741658 return self
16751659
16761660 return Table ._from_polars_lazy_frame (
1677- self ._lazy_frame .drop_nulls (subset = column_names ),
1661+ self ._lazy_frame .drop_nulls (subset = selector ),
16781662 )
16791663
16801664 def remove_rows_with_outliers (
16811665 self ,
16821666 * ,
1683- column_names : str | list [str ] | None = None ,
1667+ selector : str | list [str ] | None = None ,
16841668 z_score_threshold : float = 3 ,
16851669 ) -> Table :
16861670 """
@@ -1701,8 +1685,8 @@ def remove_rows_with_outliers(
17011685
17021686 Parameters
17031687 ----------
1704- column_names :
1705- Names of the columns to consider . If None, all numeric columns are considered .
1688+ selector :
1689+ The columns to check . If None, all columns are checked .
17061690 z_score_threshold:
17071691 The z-score threshold for detecting outliers. Must be greater than or equal to 0.
17081692
@@ -1755,14 +1739,14 @@ def remove_rows_with_outliers(
17551739 lower_bound = _ClosedBound (0 ),
17561740 )
17571741
1758- if column_names is None :
1759- column_names = self .column_names
1742+ if selector is None :
1743+ selector = self .column_names
17601744
17611745 import polars as pl
17621746 import polars .selectors as cs
17631747
17641748 # polar's `all_horizontal` raises a `ComputeError` if there are no columns
1765- selected = self ._lazy_frame .select (cs .numeric () & cs .by_name (column_names ))
1749+ selected = self ._lazy_frame .select (cs .numeric () & cs .by_name (selector ))
17661750 if not selected .collect_schema ().names ():
17671751 return self
17681752
@@ -2268,9 +2252,9 @@ def join(
22682252 right_table:
22692253 The table to join with the left table.
22702254 left_names:
2271- Name or list of names of columns to join on in the left table.
2255+ Names of columns to join on in the left table.
22722256 right_names:
2273- Name or list of names of columns to join on in the right table.
2257+ Names of columns to join on in the right table.
22742258 mode:
22752259 Specify which type of join you want to use.
22762260
0 commit comments