pydata/pandas — pull request #4234 by jorisvandenbossche (2013-07-13 18:27:35+00:00)
Title: BUG: initialize DatetimeIndex with array of strings (#4229)

Possibly a fix for #4229.

The rationale is that an array of strings should be handled in the same way as a list of strings (after applying ``np.asarray(list)``), and I supposed that the list was handling the timezone correctly.

--

More in detail:

- handling of the list of strings: https://github.com/pydata/pandas/blob/master/pandas/tseries/index.py#L196 => returning ``data``
- handling of an array of strings: https://github.com/pydata/pandas/blob/master/pandas/tseries/index.py#L211 => returning directly ``subarr``

Because in the case of an array ``subarr`` is set as a DatetimeIndex (instead of as ``.values`` attribute of it => array of datetime64), the array is not localized to UTC (https://github.com/pydata/pandas/blob/master/pandas/tseries/index.py#L249) but assumed to be UTC. So, in fact, the ``tz`` keyword is ignored.

--

Something else: it is not completely clear what the ``tz`` keyword is supposed to do (it is not documented in the DatetimeIndex docstring). But I assumed it is to say that the given values to DatetimeIndex are in that timezone (and so the behaviour with a list is correct). However, it is also a little bit strange that eg ``to_datetime`` has not such of a keyword then.

PS: the PR is not ready (I want to add some tests, release notes, and there is too much whitespace in the commit), but I just wanted to submit it already to see if this makes sense.