Skip to content

Commit 686a72e

Browse files
author
MarcoGorelli
committed
wip
1 parent 1d50e6e commit 686a72e

File tree

3 files changed

+116
-149
lines changed

3 files changed

+116
-149
lines changed

pandas/tests/io/parser/test_parse_dates.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,11 @@ def test_bad_date_parse(all_parsers, cache_dates, value):
12521252
parser = all_parsers
12531253
s = StringIO((f"{value},\n") * 50000)
12541254

1255-
if parser.engine == "pyarrow":
1255+
# TODO get back to this one and understand why we need
1256+
# all this logic!
1257+
# ok, well, the rest all works...so...open PR, and make
1258+
# sense of this?
1259+
if parser.engine == "pyarrow" and not cache_dates:
12561260
# None in input gets converted to 'None', for which
12571261
# pandas tries to guess the datetime format, triggering
12581262
# the warning. TODO: parse dates directly in pyarrow, see
@@ -1285,6 +1289,8 @@ def test_bad_date_parse_with_warning(all_parsers, cache_dates, value):
12851289
# TODO: parse dates directly in pyarrow, see
12861290
# https://github.com/pandas-dev/pandas/issues/48017
12871291
warn = None
1292+
elif cache_dates:
1293+
warn = None
12881294
else:
12891295
warn = UserWarning
12901296
parser.read_csv_check_warnings(
@@ -1737,9 +1743,7 @@ def test_parse_timezone(all_parsers):
17371743
def test_invalid_parse_delimited_date(all_parsers, date_string):
17381744
parser = all_parsers
17391745
expected = DataFrame({0: [date_string]}, dtype="object")
1740-
result = parser.read_csv_check_warnings(
1741-
UserWarning,
1742-
"Could not infer format",
1746+
result = parser.read_csv(
17431747
StringIO(date_string),
17441748
header=None,
17451749
parse_dates=[0],
@@ -2063,9 +2067,7 @@ def test_infer_first_column_as_index(all_parsers):
20632067
# GH#11019
20642068
parser = all_parsers
20652069
data = "a,b,c\n1970-01-01,2,3,4"
2066-
result = parser.read_csv_check_warnings(
2067-
UserWarning,
2068-
"Could not infer format",
2070+
result = parser.read_csv(
20692071
StringIO(data),
20702072
parse_dates=["a"],
20712073
)

pandas/tests/io/parser/usecols/test_parse_dates.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ def test_usecols_with_parse_dates4(all_parsers):
124124
}
125125
expected = DataFrame(cols, columns=["a_b"] + list("cdefghij"))
126126

127-
result = parser.read_csv_check_warnings(
128-
UserWarning,
129-
"Could not infer format",
127+
result = parser.read_csv(
130128
StringIO(data),
131129
usecols=usecols,
132130
parse_dates=parse_dates,

0 commit comments

Comments
 (0)