@@ -310,7 +310,7 @@ def _convert_listlike(arg, box, format, name=None, tz=tz):
310
310
except (ValueError , TypeError ):
311
311
raise e
312
312
313
- def _maybe_convert_cache (arg , cache ):
313
+ def _maybe_convert_cache (arg , cache , tz ):
314
314
"""Try to convert the datetimelike arg using
315
315
a cache of converted dates.
316
316
@@ -325,7 +325,8 @@ def _maybe_convert_cache(arg, cache):
325
325
unique_dates = algorithms .unique (arg )
326
326
if len (unique_dates ) != len (arg ):
327
327
from pandas import Series
328
- cache_dates = _convert_listlike (unique_dates , False , format )
328
+ cache_dates = _convert_listlike (unique_dates , True , format ,
329
+ tz = tz )
329
330
convert_cache = Series (cache_dates , index = unique_dates )
330
331
if not isinstance (arg , Series ):
331
332
arg = Series (arg )
@@ -396,23 +397,23 @@ def _maybe_convert_cache(arg, cache):
396
397
if isinstance (arg , tslib .Timestamp ):
397
398
result = arg
398
399
elif isinstance (arg , ABCSeries ):
399
- result = _maybe_convert_cache (arg , cache )
400
+ result = _maybe_convert_cache (arg , cache , tz )
400
401
if result is None :
401
402
from pandas import Series
402
403
values = _convert_listlike (arg ._values , True , format )
403
404
result = Series (values , index = arg .index , name = arg .name )
404
405
elif isinstance (arg , (ABCDataFrame , MutableMapping )):
405
406
result = _assemble_from_unit_mappings (arg , errors = errors )
406
407
elif isinstance (arg , ABCIndexClass ):
407
- result = _maybe_convert_cache (arg , cache )
408
+ result = _maybe_convert_cache (arg , cache , tz )
408
409
if result is None :
409
410
result = _convert_listlike (arg , box , format , name = arg .name )
410
411
else :
411
412
result = result .values
412
413
if box :
413
414
result = DatetimeIndex (result , tz = tz , name = arg .name )
414
415
elif is_list_like (arg ):
415
- result = _maybe_convert_cache (arg , cache )
416
+ result = _maybe_convert_cache (arg , cache , tz )
416
417
if result is None :
417
418
result = _convert_listlike (arg , box , format )
418
419
else :
0 commit comments