Skip to content

Commit

Permalink
refactor: fix timedelta warning
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed Jul 6, 2023
1 parent 3cd224e commit 6331dea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/popmon/pipeline/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def test_df_stability_metrics():
# generate metrics directly from dataframe
bin_specs = {
"date": {
"bin_width": pd.Timedelta("1y").value,
# Note that 2000 is a leap year (366 days), timedelta cannot account for this
# if this is important for the analysis, use an IDs for each year
"bin_width": pd.Timedelta("365d").value,
"bin_offset": pd.Timestamp("2000-1-1").value,
},
"latitude": {"bin_width": 5.0, "bin_offset": 0.0},
Expand Down
8 changes: 6 additions & 2 deletions tests/popmon/pipeline/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def test_df_stability_report():
features = ["date:isActive", "date:eyeColor", "date:latitude"]
bin_specs = {
"date": {
"bin_width": pd.Timedelta("1y").value,
# Note that 2000 is a leap year (366 days), timedelta cannot account for this
# if this is important for the analysis, use an IDs for each year
"bin_width": pd.Timedelta("365d").value,
"bin_offset": pd.Timestamp("2000-1-1").value,
},
"latitude": {"bin_width": 5.0, "bin_offset": 0.0},
Expand All @@ -69,7 +71,9 @@ def test_df_stability_report():


def test_df_stability_report_self():
time_width = "1y"
# Note that 2020 is a leap year (366 days), timedelta cannot account for this
# if this is important for the analysis, use an IDs for each year
time_width = "365d"
time_offset = "2020-1-1"

# generate report directly from dataframe
Expand Down

0 comments on commit 6331dea

Please sign in to comment.