Skip to content

Commit

Permalink
docs: Add that the number_of_rows will be set to 0 when removing th…
Browse files Browse the repository at this point in the history
…e last column (#384)

Closes #276 

### Summary of Changes

When removing the only column in a 1-column-table, the number_of_rows
property is set to 0. This behaviour should be documented in the Table
class docstring as well as in the following methods:
Table.keep_only_columns, Table.remove_columns,
Table.remove_columns_with_missing_values and
Table.remove_columns_with_non_numerical_values.

<!-- Please provide a summary of changes in this pull request, ensuring
all changes are explained. -->

---------

Co-authored-by: patrikguempel <[email protected]>
  • Loading branch information
alex-senger and patrikguempel committed Jun 23, 2023
1 parent 1a9e08b commit 6f5c95e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/safeds/data/tabular/containers/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class Table:
| [from_columns][safeds.data.tabular.containers._table.Table.from_columns] | Create a table from a list of columns. |
| [from_rows][safeds.data.tabular.containers._table.Table.from_rows] | Create a table from a list of rows. |
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Parameters
----------
data : Mapping[str, Sequence[Any]] | None
Expand Down Expand Up @@ -825,6 +827,8 @@ def keep_only_columns(self, column_names: list[str]) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Parameters
----------
column_names : list[str]
Expand Down Expand Up @@ -857,6 +861,8 @@ def remove_columns(self, column_names: list[str]) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Parameters
----------
column_names : list[str]
Expand Down Expand Up @@ -889,6 +895,8 @@ def remove_columns_with_missing_values(self) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Returns
-------
table : Table
Expand All @@ -902,6 +910,8 @@ def remove_columns_with_non_numerical_values(self) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Returns
-------
table : Table
Expand Down

0 comments on commit 6f5c95e

Please sign in to comment.