Skip to content

Commit

Permalink
style: fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Mar 29, 2023
1 parent 803d582 commit 46334e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/safeds/data/tabular/containers/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
from pandas import DataFrame, Series
from scipy import stats

if TYPE_CHECKING:
from ._tagged_table import TaggedTable

from ._column import Column
from ._row import Row
from safeds.data.tabular.typing import ColumnType, TableSchema
from safeds.exceptions import (
ColumnLengthMismatchError,
Expand All @@ -30,6 +25,11 @@
SchemaMismatchError,
UnknownColumnNameError,
)
from ._column import Column
from ._row import Row

if TYPE_CHECKING:
from ._tagged_table import TaggedTable


# noinspection PyProtectedMember
Expand Down Expand Up @@ -921,7 +921,7 @@ def tag_columns(self, target_name: str, feature_names: Optional[list[str]] = Non
tagged_table : TaggedTable
A new tagged table with the given target and feature names.
"""
from ._tagged_table import TaggedTable
from ._tagged_table import TaggedTable # pylint: disable=import-outside-toplevel
return TaggedTable(self._data, target_name, feature_names, self._schema)

def transform_column(self, name: str, transformer: Callable[[Row], Any]) -> Table:
Expand Down
6 changes: 1 addition & 5 deletions src/safeds/data/tabular/containers/_tagged_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ def __init__(

super().__init__(data, schema)

if feature_names is None:
self._features: Table = self.drop_columns([target_name])
else:
self._features: Table = self.keep_only_columns(feature_names)

self._features: Table = self.drop_columns([target_name]) if feature_names is None else self.keep_only_columns(feature_names)
self._target: Column = self.get_column(target_name)

@property
Expand Down
4 changes: 2 additions & 2 deletions tests/safeds/ml/test_util_sklearn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import warnings

from safeds.data.tabular.containers import Table, TaggedTable
from safeds.data.tabular.containers import Table
from safeds.ml.regression import LinearRegression


Expand All @@ -9,7 +9,7 @@ def test_predict_should_not_warn_about_feature_names() -> None:
See https://github.com/Safe-DS/Stdlib/issues/51.
"""

training_set = TaggedTable(Table({"a": [1, 2, 3], "b": [2, 4, 6]}), target_name="b")
training_set = Table({"a": [1, 2, 3], "b": [2, 4, 6]}).tag_columns(target_name="b")

model = LinearRegression()
fitted_model = model.fit(training_set)
Expand Down

0 comments on commit 46334e0

Please sign in to comment.