@@ -1295,7 +1295,9 @@ def test_datetime_bool_arrays_mixed(self, cache):
1295
1295
ValueError ,
1296
1296
match = (
1297
1297
r'^time data "True" doesn\'t match \(inferred\) format "%Y%m%d", '
1298
- "at position 1$"
1298
+ "at position 1. If your time strings are all "
1299
+ r"\(not-necessarily-identically-formatted\) ISO8601, you could "
1300
+ "try passing 'format=\" ISO8601\" '$"
1299
1301
),
1300
1302
):
1301
1303
to_datetime (["20130101" , True ], cache = cache )
@@ -2093,7 +2095,9 @@ def test_dataframe_coerce(self, cache):
2093
2095
2094
2096
msg = (
2095
2097
r'^cannot assemble the datetimes: time data ".+" doesn\'t '
2096
- r'match format "%Y%m%d", at position 1$'
2098
+ r'match format "%Y%m%d", at position 1. '
2099
+ r"If your time strings are all \(not-necessarily-identically-formatted\) "
2100
+ "ISO8601, you could try passing 'format=\" ISO8601\" '$"
2097
2101
)
2098
2102
with pytest .raises (ValueError , match = msg ):
2099
2103
to_datetime (df2 , cache = cache )
@@ -2171,7 +2175,9 @@ def test_dataframe_float(self, cache):
2171
2175
df = DataFrame ({"year" : [2000 , 2001 ], "month" : [1.5 , 1 ], "day" : [1 , 1 ]})
2172
2176
msg = (
2173
2177
r"^cannot assemble the datetimes: unconverted data remains when parsing "
2174
- r'with format ".*": "1", at position 0$'
2178
+ r'with format ".*": "1", at position 0. '
2179
+ r"If your time strings are all \(not-necessarily-identically-formatted\) "
2180
+ "ISO8601, you could try passing 'format=\" ISO8601\" '$"
2175
2181
)
2176
2182
with pytest .raises (ValueError , match = msg ):
2177
2183
to_datetime (df , cache = cache )
@@ -2254,7 +2260,9 @@ def test_to_datetime_iso8601_exact_fails(self, input, format):
2254
2260
msg = "|" .join (
2255
2261
[
2256
2262
'^unconverted data remains when parsing with format ".*": ".*"'
2257
- ", at position 0$" ,
2263
+ ", at position 0. "
2264
+ r"If your time strings are all \(not-necessarily-identically-"
2265
+ r"formatted\) ISO8601, you could try passing 'format=\"ISO8601\"'$" ,
2258
2266
'time data ".*" doesn\' t match format ".*", at position 0' ,
2259
2267
]
2260
2268
)
@@ -2856,7 +2864,9 @@ def test_day_not_in_month_raise(self, cache):
2856
2864
(
2857
2865
"2015-02-29" ,
2858
2866
"%Y-%m-%d" ,
2859
- "^day is out of range for month, at position 0$" ,
2867
+ "^day is out of range for month, at position 0. "
2868
+ r"If your time strings are all \(not-necessarily-identically-"
2869
+ r"formatted\) ISO8601, you could try passing 'format=\"ISO8601\"'$" ,
2860
2870
),
2861
2871
(
2862
2872
"2015-29-02" ,
@@ -2867,7 +2877,9 @@ def test_day_not_in_month_raise(self, cache):
2867
2877
"2015-02-32" ,
2868
2878
"%Y-%m-%d" ,
2869
2879
'^unconverted data remains when parsing with format "%Y-%m-%d": "2", '
2870
- "at position 0$" ,
2880
+ "at position 0. "
2881
+ r"If your time strings are all \(not-necessarily-identically-"
2882
+ r"formatted\) ISO8601, you could try passing 'format=\"ISO8601\"'$" ,
2871
2883
),
2872
2884
(
2873
2885
"2015-32-02" ,
@@ -2878,7 +2890,9 @@ def test_day_not_in_month_raise(self, cache):
2878
2890
(
2879
2891
"2015-04-31" ,
2880
2892
"%Y-%m-%d" ,
2881
- "^day is out of range for month, at position 0$" ,
2893
+ "^day is out of range for month, at position 0. "
2894
+ r"If your time strings are all \(not-necessarily-identically-"
2895
+ r"formatted\) ISO8601, you could try passing 'format=\"ISO8601\"'$" ,
2882
2896
),
2883
2897
(
2884
2898
"2015-31-04" ,
@@ -3290,9 +3304,7 @@ def test_incorrect_value_exception(self):
3290
3304
)
3291
3305
def test_to_datetime_out_of_bounds_with_format_arg (self , format , warning ):
3292
3306
# see gh-23830
3293
- msg = (
3294
- r"^Out of bounds nanosecond timestamp: 2417-10-10 00:00:00, at position 0$"
3295
- )
3307
+ msg = r"^Out of bounds nanosecond timestamp: 2417-10-10 00:00:00, at position 0"
3296
3308
with pytest .raises (OutOfBoundsDatetime , match = msg ):
3297
3309
with tm .assert_produces_warning (warning , match = "Could not infer format" ):
3298
3310
to_datetime ("2417-10-10 00:00:00" , format = format )
0 commit comments