Skip to content

Commit

Permalink
updated imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Ettel authored and Ettel committed Dec 20, 2023
1 parent b814bce commit 93ce4d6
Showing 1 changed file with 17 additions and 28 deletions.
45 changes: 17 additions & 28 deletions src/safeds/data/tabular/containers/_time_series.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
from __future__ import annotations

import copy
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.utils.data import Dataset
from typing import TYPE_CHECKING
from typing import overload

from safeds.data.tabular.containers import Column, Row, Table, TaggedTable

from safeds.exceptions import (
ColumnIsTargetError,
ColumnIsTimeError,
IllegalSchemaModificationError,
UnknownColumnNameError,
)

if TYPE_CHECKING:

from collections.abc import Callable, Mapping, Sequence

from safeds.data.image.containers import Image
from typing import Any


class TimeSeries(TaggedTable):

# Invarainte should be that a time is never a target or feature
# target should always be an feature
# date should never be an feature
Expand Down Expand Up @@ -95,7 +85,6 @@ def _from_tagged_table(
if time_name in feature_names:
feature_names.remove(time_name)


if time_name == tagged_table.target.name:
raise ValueError(f"Column '{time_name}' cannot be both time column and target.")

Expand All @@ -107,7 +96,7 @@ def _from_tagged_table(
return result

@staticmethod
#idk if this method should exist, because we cant use it like the Method in TaggedTable, but the Method is static and this seem to doesnt get checked by the megalinter.
# idk if this method should exist, because we cant use it like the Method in TaggedTable, but the Method is static and this seem to doesnt get checked by the megalinter.
def _from_table_to_time_series(
table: Table,
target_name: str,
Expand Down Expand Up @@ -231,22 +220,22 @@ def time(self) -> Column:
# Specific methods from time series class:
# ------------------------------------------------------------------------------------------------------------------

#def _create_moving_average(self, window_size: int) -> Column:
# calculate the windows and the moving average of a timeserties, this function for now only has intern use
# some unexpected behavior while casting to series agains, because it addds NAN values
#return Column._from_pandas_series(pd.Series(self.target._data.rolling(window_size).mean()))
#pass
#def plot_moving_average(self, window_size: int) -> Image:
# this method should plot the moving average of a time series
#pass
# def _create_moving_average(self, window_size: int) -> Column:
# calculate the windows and the moving average of a timeserties, this function for now only has intern use
# some unexpected behavior while casting to series agains, because it addds NAN values
# return Column._from_pandas_series(pd.Series(self.target._data.rolling(window_size).mean()))
# pass
# def plot_moving_average(self, window_size: int) -> Image:
# this method should plot the moving average of a time series
# pass

#def show_time_series(self) -> Image:
# this method should plot the time series
#pass
# def show_time_series(self) -> Image:
# this method should plot the time series
# pass

#def decompose_time_series(self) -> Image:
# this Method should show a plot of a decomposed time series
#pass
# def decompose_time_series(self) -> Image:
# this Method should show a plot of a decomposed time series
# pass

# ------------------------------------------------------------------------------------------------------------------
# Overriden methods from TaggedTable class:
Expand Down Expand Up @@ -851,4 +840,4 @@ def transform_column(self, name: str, transformer: Callable[[Row], Any]) -> Time
super().transform_column(name, transformer),
target_name=self.target.name,
feature_names=self.features.column_names,
),time_name= self.time.name)
), time_name=self.time.name)

0 comments on commit 93ce4d6

Please sign in to comment.