Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/fetch-fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: pytest tests/test_online_datasets.py -m "not online" -q --no-cov
- name: Open/refresh alert issue on failure
if: failure() && github.event_name == 'schedule'
uses: actions/github-script@v7
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const title = "weekly online fixture refresh failing";
Expand Down
4 changes: 3 additions & 1 deletion src/freshdata/streaming/_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ def update(self, s: pd.Series) -> None:
self.nunique_stat.update(np.array([float(s.nunique(dropna=True))]))

if is_numeric_dtype(s) and not is_bool_dtype(s):
values = pd.to_numeric(s, errors="coerce").to_numpy(dtype="float64")
# na_value: nullable (masked) columns with missing cells refuse a
# plain float64 conversion on pandas < 2.
values = pd.to_numeric(s, errors="coerce").to_numpy(dtype="float64", na_value=np.nan)
values = values[~np.isnan(values)]
if values.size:
self._welford.update(values)
Expand Down
13 changes: 7 additions & 6 deletions src/freshdata/streaming/_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,18 +428,19 @@ def _interp_series(s: pd.Series, ts: pd.Series, method: str) -> pd.Series:
return s.ffill()
if method == "bfill":
return s.bfill()
# na_value: nullable (masked) columns with missing cells refuse a plain
# float64 conversion on pandas < 2.
values = s.to_numpy(dtype="float64", na_value=np.nan)
if method == "time":
tmp = pd.Series(s.to_numpy(dtype="float64"),
index=pd.DatetimeIndex(ts))
tmp = pd.Series(values, index=pd.DatetimeIndex(ts))
try:
out = tmp.interpolate(method="time", limit_area="inside")
except ValueError: # non-monotonic / non-datetime index → linear fallback
out = pd.Series(s.to_numpy(dtype="float64")).interpolate(
method="linear", limit_area="inside")
out = pd.Series(values).interpolate(method="linear", limit_area="inside")
return pd.Series(out.to_numpy(), index=s.index)
# linear
return pd.Series(s.to_numpy(dtype="float64"),
index=s.index).interpolate(method="linear", limit_area="inside")
return pd.Series(values, index=s.index).interpolate(
method="linear", limit_area="inside")

# -- step 3: seasonal imputation -------------------------------------------

Expand Down
Loading