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

datetools.thisYearBegin is wrong #9509

Closed
craustin opened this issue Feb 17, 2015 · 4 comments
Closed

datetools.thisYearBegin is wrong #9509

craustin opened this issue Feb 17, 2015 · 4 comments
Labels

Comments

@craustin
Copy link

import pandas as pd
from datetime import datetime
pd.datetools.thisYearBegin(datetime(2015,2,1))

This returns Timestamp('2016-01-01 00:00:00'), but should return 2015-01-01. Should thisYearBegin() just be removed? I don't think it's documented.

@jreback
Copy link
Contributor

jreback commented Feb 18, 2015

These are just offset additions.

In [2]: Timestamp('20150101') + pd.offsets.YearBegin(0)
Out[2]: Timestamp('2015-01-01 00:00:00')

In [3]: Timestamp('20150102') + pd.offsets.YearBegin(0)
Out[3]: Timestamp('2016-01-01 00:00:00')

@craustin
Copy link
Author

Okay- I guess the "this" in the name confused me. Calling "thisYearBegin()" seems like it should return the first day of the given year.

On Feb 17, 2015, at 19:34, jreback notifications@github.com wrote:

These are just offset additions.

In [2]: Timestamp('20150101') + pd.offsets.YearBegin(0)
Out[2]: Timestamp('2015-01-01 00:00:00')

In [3]: Timestamp('20150102') + pd.offsets.YearBegin(0)
Out[3]: Timestamp('2016-01-01 00:00:00')

Reply to this email directly or view it on GitHub.

@jreback jreback added the Frequency DateOffsets label Feb 20, 2015
@jreback
Copy link
Contributor

jreback commented Feb 20, 2015

this entire core.datetools is just an API helper. E.g. is really just provides other names for some offset functions, IMHO just pollluting namespace (though it is separate, and i guess that was the point).

So. I think it would be straightforward to simplify this entire module, basically dumping everything except for the imports. I think you can incorporate _resolve_offset somewhere else (I think it is for back-compat).

All of the current things like thisYearBegin I think we can simply deprecate (then remove in a later version). Can you see what would break if you do this?

I know several tests use this module, but they should be changed as well.

@jorisvandenbossche
Copy link
Member

datetools is in the meantime deprecated (#14105), including thisYearBegin, so closing this.

@jorisvandenbossche jorisvandenbossche added this to the No action milestone Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants