Skip to content

Commit

Permalink
Removed unsupported numpty call
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanmarlor committed Oct 16, 2022
1 parent 81c5213 commit 2eec053
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
8 changes: 1 addition & 7 deletions custom_components/foxess_em/average/average_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,7 @@ def _resample_data(self, values) -> pd.DataFrame:
"""Resample values"""
df = pd.DataFrame.from_dict(values)

df = (
df.set_index("datetime")
.resample("1s")
.ffill()
.resample("1Min")
.mean(numeric_only=True)
)
df = df.set_index("datetime").resample("1s").ffill().resample("1Min").mean()

df = df.rename(columns={"value": "load"})
df["load"] = df["load"] / 60
Expand Down
2 changes: 1 addition & 1 deletion custom_components/foxess_em/battery/battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def charge_start_time(self, charge: float) -> datetime:
def refresh_battery_model(self, forecast: pd.DataFrame, load: pd.DataFrame) -> None:
"""Calculate battery model"""

load = load.groupby(load["time"]).mean(numeric_only=True)
load = load.groupby(load["time"]).mean()
load["time"] = load.index.values

now = datetime.utcnow()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/foxess_em/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
NAME = "foxess_em"
DOMAIN = "foxess_em"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "1.0.7"
VERSION = "1.0.0"

ISSUE_URL = "https://github.com/nathanmarlor/foxess_em/issues"

Expand Down
7 changes: 1 addition & 6 deletions custom_components/foxess_em/forecast/forecast_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,7 @@ def _resample(self, values) -> pd.DataFrame:
"""Resample values"""
df = pd.DataFrame.from_dict(values)

df = (
df.set_index("period_start")
.resample("1Min")
.mean(numeric_only=True)
.interpolate("linear")
)
df = df.set_index("period_start").resample("1Min").mean().interpolate("linear")

df["period_start"] = pd.to_datetime(df.index.values, utc=True)
df["period_start_iso"] = df["period_start"].map(lambda x: x.isoformat())
Expand Down

0 comments on commit 2eec053

Please sign in to comment.