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

Improve repr for weekly Periods #1503

Closed
petergx opened this issue Jun 20, 2012 · 2 comments
Closed

Improve repr for weekly Periods #1503

petergx opened this issue Jun 20, 2012 · 2 comments
Milestone

Comments

@petergx
Copy link

petergx commented Jun 20, 2012

It's totally possible I don't understand how to_timestamp should be used with a Period. But, I have a hunch there is a bug here.

In : p = Period('01-Jan-2012', 'W')
In : p.to_timestamp(how='E')
Out: <Timestamp: 2012-01-01 00:00:00>

In : p.to_timestamp('H', how='E')
Out: <Timestamp: 2012-01-01 23:00:00>

(found in 0.8b2)

@wesm
Copy link
Member

wesm commented Jun 20, 2012

I should improve the __repr__ for weekly to show the whole timespan.

In [18]: p = Period('01-Jan-2012', 'W')

In [19]: p.asfreq('D', 's')
Out[19]: Period('26-Dec-2011', 'D')

In [20]: p.asfreq('D', 'e')
Out[20]: Period('01-Jan-2012', 'D')

In [21]: p.asfreq('H', 's')
Out[21]: Period('26-Dec-2011 00:00', 'H')

In [22]: p.asfreq('H', 'e')
Out[22]: Period('01-Jan-2012 23:00', 'H')

However, p.to_timestamp(how='e') should possibly raise an exception, have to think about it

@petergx
Copy link
Author

petergx commented Jun 20, 2012

Ahh my bad. I think an improved __repr__ would be cool. Tho.. my confusion initially stemmed from the fact:

p.start_time == p.end_time == p.to_timestamp()

@wesm wesm closed this as completed in a66543b Jul 13, 2012
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