Skip to content

Keeping no columns with Table.keep_only_columns results in an empty Table with a row count above 0 #318

@Marsmaennchen221

Description

@Marsmaennchen221

Describe the bug

If you use the method Table.keep_only_columns with an empty list on a table that contains at least one row, you get an empty table with a row count above 0.

The methods Table.remove_columns has the same bug if you remove all columns.

To Reproduce

from safeds.data.tabular.containers import Table

table = Table({"Column1": [1, 2, 3], "Column2": [4, 5, 6]})
table = table.keep_only_columns([])

print(table)
print(table.number_of_rows)

The print statement returns 3 but the table is empty

Expected behavior

The row count should be 0 if the table is empty

Screenshots (optional)

No response

Additional Context (optional)

No response

Metadata

Metadata

Labels

releasedIncluded in a release

Type

No type

Projects

Status

✔️ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions