Skip to content

Commit b01c3ef

Browse files
committed
catch the warning in test_from_csv_with_mixed_offsets
1 parent 0549e6d commit b01c3ef

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

pandas/io/parsers/base_parser.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,14 +1144,20 @@ def converter(*date_cols, col: Hashable):
11441144
date_format.get(col) if isinstance(date_format, dict) else date_format
11451145
)
11461146

1147-
result = tools.to_datetime(
1148-
ensure_object(strs),
1149-
format=date_fmt,
1150-
utc=False,
1151-
dayfirst=dayfirst,
1152-
errors="ignore",
1153-
cache=cache_dates,
1154-
)
1147+
with warnings.catch_warnings():
1148+
warnings.filterwarnings(
1149+
"ignore",
1150+
".*parsing datetimes with mixed time zones will raise a warning",
1151+
category=FutureWarning,
1152+
)
1153+
result = tools.to_datetime(
1154+
ensure_object(strs),
1155+
format=date_fmt,
1156+
utc=False,
1157+
dayfirst=dayfirst,
1158+
errors="ignore",
1159+
cache=cache_dates,
1160+
)
11551161
if isinstance(result, DatetimeIndex):
11561162
arr = result.to_numpy()
11571163
arr.flags.writeable = True

0 commit comments

Comments
 (0)