Skip to content

Commit 70c7e7f

Browse files
committed
catch and supress "to_datetime" FutureWarning deprecation
1 parent 2054463 commit 70c7e7f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/io/json/_json.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ def _convert_axes(self) -> None:
12101210
name=axis_name,
12111211
data=ser,
12121212
use_dtypes=False,
1213-
convert_dates=True,
1213+
convert_dates=self.convert_dates,
12141214
is_axis=True,
12151215
)
12161216
if result:
@@ -1357,6 +1357,12 @@ def _try_convert_to_date(self, data: Series) -> tuple[Series, bool]:
13571357
"zones will raise an error",
13581358
category=FutureWarning,
13591359
)
1360+
warnings.filterwarnings(
1361+
"ignore",
1362+
"The behavior of 'to_datetime' with 'unit' "
1363+
"when parsing strings is deprecated.*",
1364+
category=FutureWarning,
1365+
)
13601366
new_data = to_datetime(new_data, errors="raise", unit=date_unit)
13611367
except (ValueError, OverflowError, TypeError):
13621368
continue

0 commit comments

Comments
 (0)