Skip to content

Commit 2c6d5d8

Browse files
committed
fix runtime warnings, FutureWarning and DeprecationWarning
1 parent c99b910 commit 2c6d5d8

35 files changed

Lines changed: 104 additions & 3 deletions

iglu_python/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def check_data_columns(data: pd.DataFrame, time_check=False, tz="") -> pd.DataFr
9191
raise ValueError("Data contains no glucose values")
9292

9393
# Check for missing values
94-
if data["gl"].isna().any():
95-
warnings.warn("Data contains missing glucose values")
94+
# if data["gl"].isna().any():
95+
# warnings.warn("Data contains missing glucose values")
9696

9797
# convert time to specified timezone
9898
# TODO: check if this is correct (R-implementation compatibility)

tests/test_above_percent.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22

33
import pandas as pd
4+
import numpy as np
45
import pytest
56

67
import iglu_python as iglu
@@ -48,6 +49,9 @@ def test_above_percent_iglu_r_compatible(scenario):
4849
expected_results = scenario["results"]
4950
expected_df = pd.DataFrame(expected_results)
5051
expected_df = expected_df.reset_index(drop=True)
52+
pd.set_option('future.no_silent_downcasting', True)
53+
expected_df = expected_df.replace({None: np.nan})
54+
5155

5256
# Compare DataFrames with precision to 0.001
5357
pd.testing.assert_frame_equal(

tests/test_active_percent.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def test_active_percent_iglu_r_compatible(scenario):
3434
expected_results = scenario["results"]
3535
expected_df = pd.DataFrame(expected_results)
3636
expected_df = expected_df.reset_index(drop=True)
37+
pd.set_option('future.no_silent_downcasting', True)
38+
expected_df = expected_df.replace({None: np.nan})
39+
3740

3841
# Read CSV and convert time column to datetime
3942
df = pd.read_csv(input_file_name, index_col=0)

tests/test_adrr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22

33
import pandas as pd
4+
import numpy as np
45
import pytest
56

67
import iglu_python as iglu
@@ -48,6 +49,9 @@ def test_adrr_iglu_r_compatible(scenario):
4849
expected_results = scenario["results"]
4950
expected_df = pd.DataFrame(expected_results)
5051
expected_df = expected_df.reset_index(drop=True)
52+
pd.set_option('future.no_silent_downcasting', True)
53+
expected_df = expected_df.replace({None: np.nan})
54+
5155

5256
# Compare DataFrames with precision to 0.001 for numeric columns
5357
pd.testing.assert_frame_equal(

tests/test_auc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def test_auc_iglu_r_compatible(scenario):
4141
expected_results = scenario["results"]
4242
expected_df = pd.DataFrame(expected_results)
4343
expected_df = expected_df.reset_index(drop=True)
44+
pd.set_option('future.no_silent_downcasting', True)
45+
expected_df = expected_df.replace({None: np.nan})
46+
4447

4548

4649
result_df = iglu.auc(df, **kwargs)

tests/test_conga.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def test_conga_iglu_r_compatible(scenario):
3333
expected_results = scenario["results"]
3434
expected_df = pd.DataFrame(expected_results)
3535
expected_df = expected_df.reset_index(drop=True)
36+
pd.set_option('future.no_silent_downcasting', True)
37+
expected_df = expected_df.replace({None: np.nan})
38+
3639

3740
# Read CSV and convert time column to datetime
3841
df = pd.read_csv(input_file_name, index_col=0)

tests/test_ea1c.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def test_ea1c_iglu_r_compatible(scenario):
4646
expected_results = scenario["results"]
4747
expected_df = pd.DataFrame(expected_results)
4848
expected_df = expected_df.reset_index(drop=True)
49+
pd.set_option('future.no_silent_downcasting', True)
50+
expected_df = expected_df.replace({None: np.nan})
51+
4952

5053
# Read CSV and convert time column to datetime
5154
df = pd.read_csv(input_file_name, index_col=0)

tests/test_episode_calculation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ def test_episode_calculation_iglu_r_compatible(scenario):
3535
# this is extended expected result, with two separate dataframes
3636
assert kwargs["return_data"]
3737
expected_episodes_df = pd.DataFrame(expected_results['episodes']).reset_index(drop=True)
38+
expected_episodes_df = expected_episodes_df.infer_objects(copy=False)
3839
expected_data_df = pd.DataFrame(expected_results['data']).reset_index(drop=True)
40+
expected_data_df = expected_data_df.infer_objects(copy=False)
3941
else :
4042
expected_episodes_df = pd.DataFrame(expected_results).reset_index(drop=True)
43+
expected_episodes_df = expected_episodes_df.infer_objects(copy=False)
4144
expected_data_df = None
4245

4346

tests/test_grade.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def test_grade_iglu_r_compatible(scenario):
3434
expected_results = scenario["results"]
3535
expected_df = pd.DataFrame(expected_results)
3636
expected_df = expected_df.reset_index(drop=True)
37+
pd.set_option('future.no_silent_downcasting', True)
38+
expected_df = expected_df.replace({None: np.nan})
39+
3740

3841
# Read CSV and convert time column to datetime
3942
df = pd.read_csv(input_file_name, index_col=0)

tests/test_grade_eugly.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def test_grade_eugly_iglu_r_compatible(scenario):
3434
expected_results = scenario["results"]
3535
expected_df = pd.DataFrame(expected_results)
3636
expected_df = expected_df.reset_index(drop=True)
37+
pd.set_option('future.no_silent_downcasting', True)
38+
expected_df = expected_df.replace({None: np.nan})
39+
3740

3841
# Read CSV and convert time column to datetime
3942
df = pd.read_csv(input_file_name, index_col=0)

0 commit comments

Comments
 (0)