Skip to content

Misleading __str__/__repr__ for DatatimeIndex objects with less than 3 items #1611

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

Closed
manuteleco opened this issue Jul 12, 2012 · 1 comment
Milestone

Comments

@manuteleco
Copy link

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.

@wesm wesm closed this as completed in 221ab06 Jul 12, 2012
@wesm
Copy link
Member

wesm commented Jul 12, 2012

Good idea. Made this change

@ghost ghost mentioned this issue Apr 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants