Skip to content

Commit dfdc4f6

Browse files
committed
BUG: revert parts of pandas-dev#40037
1 parent 8837b36 commit dfdc4f6

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

pandas/core/dtypes/cast.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
)
2727
import warnings
2828

29-
from dateutil.parser import ParserError
3029
import numpy as np
3130

3231
from pandas._libs import (
@@ -1588,19 +1587,10 @@ def maybe_cast_to_datetime(
15881587
value = to_timedelta(value, errors="raise")._values
15891588
except OutOfBoundsDatetime:
15901589
raise
1591-
except ParserError:
1592-
# Note: ParserError subclasses ValueError
1593-
# str that we can't parse to datetime
1590+
except ValueError:
1591+
# TODO(GH#40048): only catch dateutil's ParserError
1592+
# once we can reliably import it in all supported versions
15941593
pass
1595-
except ValueError as err:
1596-
if "mixed datetimes and integers in passed array" in str(err):
1597-
# array_to_datetime does not allow this;
1598-
# when called from _try_cast, this will be followed
1599-
# by a call to construct_1d_ndarray_preserving_na
1600-
# which will convert these
1601-
pass
1602-
else:
1603-
raise
16041594

16051595
# coerce datetimelike to object
16061596
elif is_datetime64_dtype(

0 commit comments

Comments
 (0)