Skip to content

Commit

Permalink
Fix invalid type hints for pd.Series
Browse files Browse the repository at this point in the history
  • Loading branch information
Tveten committed Aug 21, 2024
1 parent 42cc9c7 commit 3c8603e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions skchange/anomaly_detectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PointAnomalyDetector(BaseDetector):
"""

@staticmethod
def sparse_to_dense(y_sparse: pd.Series, index: pd.Index) -> pd.Series[int]:
def sparse_to_dense(y_sparse: pd.Series, index: pd.Index) -> pd.Series:
"""Convert the sparse output from the predict method to a dense format.
Parameters
Expand All @@ -51,7 +51,7 @@ def sparse_to_dense(y_sparse: pd.Series, index: pd.Index) -> pd.Series[int]:
return y_dense

@staticmethod
def dense_to_sparse(y_dense: pd.Series) -> pd.Series[int]:
def dense_to_sparse(y_dense: pd.Series) -> pd.Series:
"""Convert the dense output from the transform method to a sparse format.
Parameters
Expand Down Expand Up @@ -96,9 +96,7 @@ class CollectiveAnomalyDetector(BaseDetector):
"""

@staticmethod
def sparse_to_dense(
y_sparse: pd.Series[pd.Interval], index: pd.Index
) -> pd.Series[int]:
def sparse_to_dense(y_sparse: pd.Series, index: pd.Index) -> pd.Series:
"""Convert the sparse output from the predict method to a dense format.
Parameters
Expand All @@ -122,7 +120,7 @@ def sparse_to_dense(
return pd.Series(y_dense, index=index, name="anomaly", dtype="int64")

@staticmethod
def dense_to_sparse(y_dense: pd.Series) -> pd.Series[pd.Interval]:
def dense_to_sparse(y_dense: pd.Series) -> pd.Series:
"""Convert the dense output from the transform method to a sparse format.
Parameters
Expand Down
4 changes: 2 additions & 2 deletions skchange/change_detectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ChangepointDetector(BaseDetector):
"""

@staticmethod
def sparse_to_dense(y_sparse: pd.Series, index: pd.Index) -> pd.Series[int]:
def sparse_to_dense(y_sparse: pd.Series, index: pd.Index) -> pd.Series:
"""Convert the sparse output from the predict method to a dense format.
Parameters
Expand All @@ -62,7 +62,7 @@ def sparse_to_dense(y_sparse: pd.Series, index: pd.Index) -> pd.Series[int]:
return y_dense

@staticmethod
def dense_to_sparse(y_dense: pd.Series) -> pd.Series[int]:
def dense_to_sparse(y_dense: pd.Series) -> pd.Series:
"""Convert the dense output from the transform method to a sparse format.
Parameters
Expand Down

0 comments on commit 3c8603e

Please sign in to comment.