Skip to content

Commit

Permalink
update 7 files
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed Aug 30, 2024
1 parent d317a64 commit 584d31c
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 254 deletions.
394 changes: 172 additions & 222 deletions docs/tutorials/01_basic.ipynb

Large diffs are not rendered by default.

20 changes: 4 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"frozendict>=2.3.4",
"coloredlogs>14.0.0",
"tqdm>4.1.0",
"polars>0.19.0",
"polars>=0.19.0",
"iterpy==1.6.0",
"rich>=13.0.0",
"ipykernel[docs]>=6.29.5",
Expand Down Expand Up @@ -70,7 +70,7 @@ docs = [
"sphinx_design==0.3.0",
"ipykernel>=6.29.5",
]
tutorials = ["jupyter>=1.0.0,<1.1.0", "skimpy>=0.0.11"]
tutorials = ["jupyter>=1.0.0,<1.1.0", "skimpy==0.0.15"]

[project.readme]
file = "README.md"
Expand All @@ -81,20 +81,8 @@ homepage = "https://github.com/Aarhus-Psychiatry-Research/timeseriesflattener"
repository = "https://github.com/Aarhus-Psychiatry-Research/timeseriesflattener"
documentation = "https://aarhus-psychiatry-research.github.io/timeseriesflattener/"

[tool]
rye = { dev-dependencies = [
"pytest>=7.1.3, <7.3.0",
"pytest-cov>=3.0.0, <3.1.0",
"pytest-xdist>=3.0.0, <3.2.0",
"pytest-sugar>=0.9.4, <0.10.0",
"pytest-testmon==2.1.0",
"pytest-benchmark==4.0.0",
"pytest-codspeed==2.2.0",
"invoke==2.1.1",
"pyright==1.1.330.post0",
"pandas-stubs>=2.0.3.230814",
"ruff>=0.2.2",
] }
[tool.uv]
override-dependencies = ["polars >= 1.0"]

[tool.pyright]
exclude = [".*venv*/", ".venv38/", ".tox", ".benchmark_cache"]
Expand Down
4 changes: 2 additions & 2 deletions src/timeseriesflattener/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def assert_frame_equal(
result: pl.DataFrame, expected: pl.DataFrame, ignore_colums: Sequence[str] = ()
):
polars_testing.assert_frame_equal(
result.drop(ignore_colums),
expected.drop(ignore_colums),
result.drop(ignore_colums, strict=False),
expected.drop(ignore_colums, strict=False),
check_dtypes=False,
check_column_order=False,
)
Expand Down
7 changes: 4 additions & 3 deletions src/timeseriesflattener/processors/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ def _aggregate_masked_frame(
)
rename_mapping = dict(value_columns)

with_fallback = grouped_frame.with_columns(
cs.contains(masked_frame.value_col_names).fill_null(fallback)
).rename(rename_mapping)
for col in masked_frame.value_col_names:
with_fallback = grouped_frame.with_columns(cs.contains(col).fill_null(fallback)).rename(
rename_mapping
)

return with_fallback

Expand Down
3 changes: 2 additions & 1 deletion src/timeseriesflattener/specs/outcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dataclasses import InitVar, dataclass
from typing import TYPE_CHECKING

import pandas as pd
import polars as pl
from timeseriesflattener.specs import _lookdistance_to_timedelta

Expand Down Expand Up @@ -114,7 +115,7 @@ def df(self) -> pl.DataFrame:

@staticmethod
def from_primitives(
df: pl.DataFrame,
df: pl.DataFrame | pd.DataFrame,
entity_id_col_name: str,
lookahead_days: Sequence[float | tuple[float, float]],
aggregators: Sequence[AggregatorName],
Expand Down
2 changes: 1 addition & 1 deletion src/timeseriesflattener/testing/load_synth_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def synth_predictor_binary() -> pl.DataFrame:
def load_synth_outcome() -> pl.DataFrame:
# Get first row for each id
df = load_raw_test_csv("synth_raw_binary_2.csv")
df = df.groupby("entity_id").last()
df = df.group_by("entity_id").last()

# Drop all rows with a value equal to 1
df = df.filter(pl.col("value") == 1)
Expand Down
21 changes: 12 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 584d31c

Please sign in to comment.