Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
feat: compatibility with safe-ds v0.11.0 (#53)
Browse files Browse the repository at this point in the history
### Summary of Changes

Integrate API changes of [safe-ds
v0.11.0](https://github.com/Safe-DS/Stdlib/releases/tag/v0.11.0).
  • Loading branch information
lars-reimann authored Apr 22, 2023
1 parent d81767b commit 462ec46
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/examples/house_sales.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"execution_count": null,
"outputs": [],
"source": [
"house_sales.schema"
"print(str(house_sales.schema))"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -123,7 +123,7 @@
" \"latitude\",\n",
" \"longitude\"\n",
"])\n",
"house_sales_correlation.correlation_heatmap()"
"house_sales_correlation.plot_correlation_heatmap()"
],
"metadata": {
"collapsed": false
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/titanic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"execution_count": null,
"outputs": [],
"source": [
"titanic.schema"
"print(str(titanic.schema))"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -122,7 +122,7 @@
" \"fare\",\n",
" \"survived\"\n",
"])\n",
"titanic_correlation.correlation_heatmap()"
"titanic_correlation.plot_correlation_heatmap()"
],
"metadata": {
"collapsed": false
Expand Down
107 changes: 103 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages = [

[tool.poetry.dependencies]
python = "^3.10"
safe-ds = ">=0.10,<0.11"
safe-ds = ">=0.11,<0.12"

[tool.poetry.group.dev.dependencies]
pytest = "^7.2.1"
Expand Down
6 changes: 3 additions & 3 deletions src/safeds_examples/tabular/containers/_example_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ExampleTable(Table):

def __init__(self, table: Table, column_descriptions: dict[str, str]) -> None:
# Check that all column names in `descriptions` exist in `table`
invalid_column_names = set(column_descriptions.keys()) - set(table.get_column_names())
invalid_column_names = set(column_descriptions.keys()) - set(table.column_names)
if invalid_column_names:
raise UnknownColumnNameError(list(invalid_column_names))

Expand All @@ -38,7 +38,7 @@ def column_descriptions(self) -> Table:
return Table(
[
{"Name": column_name, "Description": self.get_column_description(column_name)}
for column_name in self.get_column_names()
for column_name in self.column_names
],
)

Expand All @@ -61,7 +61,7 @@ def get_column_description(self, column_name: str) -> str:
UnknownColumnNameError
If no column with the given name exists.
"""
if column_name not in self.get_column_names():
if column_name not in self.column_names:
raise UnknownColumnNameError([column_name])

return self._descriptions.get(column_name, "")
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_returns_table(self) -> None:
assert isinstance(house_sales, Table)

def test_row_count(self, house_sales: Table) -> None:
assert house_sales.count_rows() == 21613
assert house_sales.n_rows == 21613

def test_schema(self, house_sales: Table) -> None:
assert house_sales.schema == Schema(
Expand Down Expand Up @@ -58,4 +58,4 @@ def test_all_columns_have_descriptions(self) -> None:
house_sales = load_house_sales()
descriptions = house_sales.column_descriptions

assert set(descriptions.get_column("Name")._data) == set(house_sales.get_column_names())
assert set(descriptions.get_column("Name")._data) == set(house_sales.column_names)
4 changes: 2 additions & 2 deletions tests/safeds_examples/tabular/_titanic/test_titanic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_returns_table(self) -> None:
assert isinstance(titanic, Table)

def test_row_count(self, titanic: Table) -> None:
assert titanic.count_rows() == 1309
assert titanic.n_rows == 1309

def test_schema(self, titanic: Table) -> None:
assert titanic.schema == Schema(
Expand Down Expand Up @@ -47,4 +47,4 @@ def test_all_columns_have_descriptions(self) -> None:
titanic = load_titanic()
descriptions = titanic.column_descriptions

assert set(descriptions.get_column("Name")._data) == set(titanic.get_column_names())
assert set(descriptions.get_column("Name")._data) == set(titanic.column_names)

0 comments on commit 462ec46

Please sign in to comment.