-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #519 ### Summary of Changes I added the visualization of the lag plot to the timeseries class --------- Co-authored-by: megalinter-bot <[email protected]>
- Loading branch information
1 parent
2f1d5c5
commit 0fb38d2
Showing
4 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+11.3 KB
...ged_table/_time_series/__snapshots__/test_plot_lag/test_should_return_table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_plot_lag.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import pytest | ||
from safeds.data.tabular.containers import TimeSeries | ||
from safeds.exceptions import NonNumericColumnError | ||
from syrupy import SnapshotAssertion | ||
|
||
|
||
def test_should_return_table(snapshot_png: SnapshotAssertion) -> None: | ||
table = TimeSeries( | ||
{ | ||
"time": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
"feature_1": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
"target": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
}, | ||
target_name="target", | ||
time_name="time", | ||
feature_names=None, | ||
) | ||
lag_plot = table.plot_lagplot(lag=1) | ||
assert lag_plot == snapshot_png | ||
|
||
|
||
def test_should_raise_if_column_contains_non_numerical_values() -> None: | ||
table = TimeSeries( | ||
{ | ||
"time": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
"feature_1": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], | ||
"target": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], | ||
}, | ||
target_name="target", | ||
time_name="time", | ||
feature_names=None, | ||
) | ||
with pytest.raises( | ||
NonNumericColumnError, | ||
match=( | ||
r"Tried to do a numerical operation on one or multiple non-numerical columns: \nThis time series target" | ||
r" contains" | ||
r" non-numerical columns." | ||
), | ||
): | ||
table.plot_lagplot(2) |