Misleading str/repr for DatatimeIndex objects with less than 3 items · Issue #1611 · pandas-dev/pandas (original) (raw)

Hi,

this isn't such a big issue, but I guess it's worth reporting anyway.

I'm using the development version '0.8.1.dev-0e5fc44'. DatetimeIndex __str__ and __repr__ methods always return a string that contains a list-like representation of the contents in this fashion: [first_item, ..., last_item].
That format is used even when the DatetimeIndex has 1 or 2 elements, which should be represented like [only_item] and [first_item, last_item] respectively.

Example:

In [32]: to_datetime(["2012-01-01"])
Out[32]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2012-01-01 00:00:00, ..., 2012-01-01 00:00:00]
Length: 1, Freq: None, Timezone: None

Thanks and regards.