Skip to content

Commit

Permalink
reverted type annotations due to import issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kilianp14 committed Nov 20, 2023
1 parent 981b920 commit 5264fa6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vessim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import Union, List, Optional, Any, Literal

import pandas as pd
from pandas._typing import InterpolateOptions

DatetimeLike = Union[str, datetime]

Expand Down Expand Up @@ -136,6 +135,7 @@ def actual(self, dt: DatetimeLike, zone: Optional[str] = None) -> Any:
]

# Mypy somehow has trouble with indexing in a dataframe with DatetimeIndex
# <https://github.com/python/mypy/issues/2410>
if dt in self._actual.index:
return self._actual.loc[dt, zone] # type: ignore
elif self._fill_method == "ffill" and dt > self._actual.index[0]:
Expand All @@ -151,7 +151,7 @@ def forecast(
end_time: DatetimeLike,
zone: Optional[str] = None,
frequency: Optional[Union[str, pd.DateOffset, timedelta]] = None,
resample_method: Optional[InterpolateOptions] = None,
resample_method: Optional[str] = None,
) -> pd.Series:
"""Retrieves of forecasted data points within window at a frequency.
Expand Down Expand Up @@ -308,7 +308,7 @@ def _resample_to_frequency(
start_time: datetime,
end_time: datetime,
frequency: pd.DateOffset,
resample_method: Optional[InterpolateOptions] = None,
resample_method: Optional[str] = None,
) -> pd.Series:
"""Transform series into the desired frequency between start and end time."""
# Cutoff data for performance
Expand All @@ -329,7 +329,7 @@ def _resample_to_frequency(
if resample_method == "ffill":
df.ffill(inplace=True)
else:
df.interpolate(method=resample_method, inplace=True)
df.interpolate(method=resample_method, inplace=True) # type: ignore

# Get the data to the desired frequency after interpolation
return df.loc[start_time:end_time].asfreq(frequency) # type: ignore
Expand Down

0 comments on commit 5264fa6

Please sign in to comment.