@@ -463,7 +463,7 @@ def test_to_datetime_parse_tzname_or_tzoffset_utc_false_removed(
463
463
self , fmt , dates , expected_dates
464
464
):
465
465
# GH#13486, GH#50887, GH#57275
466
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
466
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
467
467
with pytest .raises (ValueError , match = msg ):
468
468
to_datetime (dates , format = fmt )
469
469
@@ -646,7 +646,7 @@ def test_to_datetime_mixed_dt_and_str_with_format_mixed_offsets_utc_false_remove
646
646
args = ["2000-01-01 01:00:00" , "2000-01-01 02:00:00+00:00" ]
647
647
ts1 = constructor (args [0 ])
648
648
ts2 = args [1 ]
649
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
649
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
650
650
651
651
with pytest .raises (ValueError , match = msg ):
652
652
to_datetime ([ts1 , ts2 ], format = fmt , utc = False )
@@ -679,7 +679,7 @@ def test_to_datetime_mixed_offsets_with_none_tz_utc_false_removed(
679
679
):
680
680
# https://github.com/pandas-dev/pandas/issues/50071
681
681
# GH#57275
682
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
682
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
683
683
684
684
with pytest .raises (ValueError , match = msg ):
685
685
to_datetime (
@@ -1152,7 +1152,7 @@ def test_to_datetime_different_offsets_removed(self, cache):
1152
1152
ts_string_1 = "March 1, 2018 12:00:00+0400"
1153
1153
ts_string_2 = "March 1, 2018 12:00:00+0500"
1154
1154
arr = [ts_string_1 ] * 5 + [ts_string_2 ] * 5
1155
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
1155
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
1156
1156
with pytest .raises (ValueError , match = msg ):
1157
1157
to_datetime (arr , cache = cache )
1158
1158
@@ -1509,7 +1509,7 @@ def test_to_datetime_coerce(self):
1509
1509
"March 1, 2018 12:00:00+0500" ,
1510
1510
"20100240" ,
1511
1511
]
1512
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
1512
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
1513
1513
with pytest .raises (ValueError , match = msg ):
1514
1514
to_datetime (ts_strings , errors = "coerce" )
1515
1515
@@ -1581,7 +1581,7 @@ def test_iso_8601_strings_with_same_offset(self):
1581
1581
def test_iso_8601_strings_with_different_offsets_removed (self ):
1582
1582
# GH#17697, GH#11736, GH#50887, GH#57275
1583
1583
ts_strings = ["2015-11-18 15:30:00+05:30" , "2015-11-18 16:30:00+06:30" , NaT ]
1584
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
1584
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
1585
1585
with pytest .raises (ValueError , match = msg ):
1586
1586
to_datetime (ts_strings )
1587
1587
@@ -1608,7 +1608,7 @@ def test_mixed_offsets_with_native_datetime_utc_false_raises(self):
1608
1608
ser = Series (vals )
1609
1609
assert all (ser [i ] is vals [i ] for i in range (len (vals ))) # GH#40111
1610
1610
1611
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
1611
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
1612
1612
with pytest .raises (ValueError , match = msg ):
1613
1613
to_datetime (ser )
1614
1614
@@ -1673,7 +1673,7 @@ def test_to_datetime_fixed_offset(self):
1673
1673
)
1674
1674
def test_to_datetime_mixed_offsets_with_utc_false_removed (self , date ):
1675
1675
# GH#50887, GH#57275
1676
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
1676
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
1677
1677
with pytest .raises (ValueError , match = msg ):
1678
1678
to_datetime (date , utc = False )
1679
1679
@@ -3463,7 +3463,7 @@ def test_to_datetime_with_empty_str_utc_false_format_mixed():
3463
3463
3464
3464
def test_to_datetime_with_empty_str_utc_false_offsets_and_format_mixed ():
3465
3465
# GH#50887, GH#57275
3466
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
3466
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
3467
3467
3468
3468
with pytest .raises (ValueError , match = msg ):
3469
3469
to_datetime (
@@ -3479,7 +3479,7 @@ def test_to_datetime_mixed_tzs_mixed_types():
3479
3479
arr = [ts , dtstr ]
3480
3480
3481
3481
msg = (
3482
- "Mixed timezones detected. pass utc=True in to_datetime or tz='UTC' "
3482
+ "Mixed timezones detected. Pass utc=True in to_datetime or tz='UTC' "
3483
3483
"in DatetimeIndex to convert to a common timezone"
3484
3484
)
3485
3485
with pytest .raises (ValueError , match = msg ):
@@ -3578,15 +3578,15 @@ def test_to_datetime_mixed_awareness_mixed_types(aware_val, naive_val, naive_fir
3578
3578
to_datetime (vec , utc = True )
3579
3579
3580
3580
else :
3581
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
3581
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
3582
3582
with pytest .raises (ValueError , match = msg ):
3583
3583
to_datetime (vec )
3584
3584
3585
3585
# No warning/error with utc=True
3586
3586
to_datetime (vec , utc = True )
3587
3587
3588
3588
if both_strs :
3589
- msg = "cannot parse datetimes with mixed time zones unless ` utc=True` "
3589
+ msg = "Mixed timezones detected. Pass utc=True in to_datetime "
3590
3590
with pytest .raises (ValueError , match = msg ):
3591
3591
to_datetime (vec , format = "mixed" )
3592
3592
with pytest .raises (ValueError , match = msg ):
0 commit comments