Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior initializing DatetimeIndex to tz with list/array of string times #4229

rockg opened this issue Jul 13, 2013 · 1 comment


Copy link

commented Jul 13, 2013

Initializing a DatetimeIndex with a list of strings behaves differently than initializing with a numpy array of strings. To me these should behave the same and I personally like the list behavior better. My understanding of the tz argument to DatetimeIndex is that it is localizing rather than converting in which case the numpy array case is inconsistent. I don't think there should be an assumption made about the tz of the strings before indicating it by localizing.

>>> idx = ['11/10/2005 08:00:00','11/10/2005 09:00:00']
>>> DatetimeIndex(idx, tz='US/Eastern')
<class 'pandas.tseries.index.DatetimeIndex'>
[2005-11-10 08:00:00, 2005-11-10 09:00:00]
Length: 2, Freq: None, Timezone: US/Eastern
>>> import numpy as np
>>> idxnp = np.array(idx)
>>> DatetimeIndex(idxnp, tz='US/Eastern')
<class 'pandas.tseries.index.DatetimeIndex'>
[2005-11-10 03:00:00, 2005-11-10 04:00:00]
Length: 2, Freq: None, Timezone: US/Eastern
jorisvandenbossche added a commit to jorisvandenbossche/pandas that referenced this issue Jul 14, 2013
jreback added a commit that referenced this issue Jul 14, 2013
Merge pull request #4234 from jorisvandenbossche/bug-datetimeindex-li…

BUG: initialize DatetimeIndex with array of strings (#4229)

This comment has been minimized.

Copy link

commented Jul 14, 2013

closed via #4234

@jreback jreback closed this Jul 14, 2013

yarikoptic added a commit to neurodebian/pandas that referenced this issue Jul 25, 2013
Merge commit 'v0.12.0rc1-79-g50eff60' into debian
* commit 'v0.12.0rc1-79-g50eff60': (23 commits)
  CLN: replace __repr__ with __unicode__ for string printing (to use StringMixIn)
  BLD: use wheels and newer scipy bc of 33 scipy issue
  TST: force rebuild
  TST: remove fudgy ujson test pandas-dev#4223
  BUG: initialize DatetimeIndex with array of strings (pandas-dev#4229)
  BUG: set name attr in DatetimeIndex and PeriodIndex
  Updated release note about GH4216.
  Check if a plotting DataFrame with kind='kde' has a legend. GH4216
  BUG: Display the legend when calling plot with kind='density'. GH4216
  TST/BUG: disallow bs4==4.2.0 and skip assoc tests
  BLD: test_perf tweaks
  CLN: correct format string
  DOC: release notes
  BUG: raise on invalid colormap for older mpl
  TST: little endian failure, GH4222
  CLN/ENH: clean up docstrings remove some cruft and generalize
  BLD: Turn off the ISRELEASED flag in
  DOC: minor io.rst edits
  DOC: remove savefig width parameter (pandas-dev#4203)
  BLD: pip 1.4 is coming, preempt issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.