BUG: to_datetime with unit, utc=True and errors='ignore' does not coerce to UTC · Issue #23758 · pandas-dev/pandas (original) (raw)

In [3]: pd.__version__
Out[3]: '0.24.0.dev0+1040.g24bce1a5f'

In [4]: pd.to_datetime([1], unit='s', box=True, utc=True, errors='ignore')
Out[4]: DatetimeIndex(['1970-01-01 00:00:01'], dtype='datetime64[ns]', freq=None)

It appears the tz argument is missing from the output here:

pandas/pandas/core/tools/datetimes.py

Line 215 in24bce1a

return Index(result, name=name)

Expected Output

In [4]: pd.to_datetime([1], unit='s', box=True, utc=True, errors='ignore')
Out[4]: DatetimeIndex(['1970-01-01 00:00:01+00:00'], dtype='datetime64[ns, UTC]', freq=None)