Skip to content

Commit 1e98e2d

Browse files
committed
control warn
1 parent b4ba914 commit 1e98e2d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cheetahpy/local_opendata.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _athlete_summary_path(self, athlete_id: str) -> str:
9292
return ath_summary_path
9393

9494
@staticmethod
95-
def _safe_convert(original_series:pd.Series, type_convert:type) -> pd.Series:
95+
def _safe_convert(original_series:pd.Series, type_convert:type, warn_on_convert:bool=False) -> pd.Series:
9696
try:
9797
new_series = original_series.astype(type_convert)
9898
return new_series
@@ -102,7 +102,8 @@ def _safe_convert(original_series:pd.Series, type_convert:type) -> pd.Series:
102102
a_value_type = type(a_value[0])
103103
else:
104104
a_value_type = "UNKNOWN"
105-
logger.warning(f'[{err}] cannot convert {original_series.name} (of type: {a_value_type}) to type {type_convert}')
105+
if warn_on_convert:
106+
logger.warning(f'[{err}] cannot convert {original_series.name} (of type: {a_value_type}) to type {type_convert}')
106107
return original_series
107108

108109
@staticmethod

0 commit comments

Comments
 (0)