Skip to content

Commit d50802c

Browse files
author
MarcoGorelli
committed
post-merge fixup
1 parent fbca843 commit d50802c

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

doc/source/user_guide/timeseries.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ you can pass the ``dayfirst`` flag:
214214
215215
.. warning::
216216

217-
You see in the above example that ``dayfirst`` isn't strict, so if a date
217+
You see in the above example that ``dayfirst`` isn't strict. If a date
218218
can't be parsed with the day being first it will be parsed as if
219219
``dayfirst`` were ``False`` and a warning will also be raised.
220220

doc/source/whatsnew/v1.4.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ Notable bug fixes
249249

250250
These are bug fixes that might have notable behavior changes.
251251

252-
.. _whatsnew_140.notable_bug_fixes.notable_bug_fix1:
252+
.. _whatsnew_140.notable_bug_fixes.inconsistent_date_string_parsing:
253253

254254
Inconsistent date string parsing
255255
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

pandas/tests/io/parser/test_parse_dates.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
timezone,
1111
)
1212
from io import StringIO
13+
import warnings
1314

1415
from dateutil.parser import parse as du_parse
1516
from hypothesis import given
@@ -1664,16 +1665,16 @@ def test_invalid_parse_delimited_date(all_parsers, date_string):
16641665
"date_string,dayfirst,expected",
16651666
[
16661667
# %d/%m/%Y; month > 12 thus replacement
1667-
("13/02/2019", False, datetime(2019, 2, 13)),
16681668
("13/02/2019", True, datetime(2019, 2, 13)),
16691669
# %m/%d/%Y; day > 12 thus there will be no replacement
16701670
("02/13/2019", False, datetime(2019, 2, 13)),
1671-
("02/13/2019", True, datetime(2019, 2, 13)),
16721671
# %d/%m/%Y; dayfirst==True thus replacement
16731672
("04/02/2019", True, datetime(2019, 2, 4)),
16741673
],
16751674
)
1676-
def test_parse_delimited_date_swap(all_parsers, date_string, dayfirst, expected):
1675+
def test_parse_delimited_date_swap_no_warning(
1676+
all_parsers, date_string, dayfirst, expected
1677+
):
16771678
parser = all_parsers
16781679
expected = DataFrame({0: [expected]}, dtype="datetime64[ns]")
16791680
result = parser.read_csv(
@@ -1750,9 +1751,11 @@ def test_hypothesis_delimited_date(
17501751
)
17511752
date_string = test_datetime.strftime(date_format.replace(" ", delimiter))
17521753

1753-
except_out_dateutil, result = _helper_hypothesis_delimited_date(
1754-
parse_datetime_string, date_string, dayfirst=dayfirst
1755-
)
1754+
with warnings.catch_warnings():
1755+
warnings.filterwarnings("ignore", category=UserWarning)
1756+
except_out_dateutil, result = _helper_hypothesis_delimited_date(
1757+
parse_datetime_string, date_string, dayfirst=dayfirst
1758+
)
17561759
except_in_dateutil, expected = _helper_hypothesis_delimited_date(
17571760
du_parse,
17581761
date_string,

0 commit comments

Comments
 (0)