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
Bug in to_frame.origin_as_datetime argument #248
Comments
Here is an active deprecation notice in the library currently - chainladder-python/chainladder/__init__.py Lines 28 to 30 in 3398979
I haven't given much thought to good messaging though. I'm sure whatever you choose will work just fine. |
@jbogaardt do you know if import pandas as pd
import chainladder as cl
quarterly = cl.load_sample("quarterly")
quarterly["paid"].to_frame(origin_as_datetime=True).index == quarterly["paid"].to_frame(
origin_as_datetime=False
).index |
Hah, I guess it did not. No sense in having a deprecation notice on a bug. |
lol... Hmm, what should we do here? Let's close this ticket and open a new one? |
Repurposed this issue as a bug. |
I think I was able to fix the bug, but now the question is I actually don't know if I actually think it's more useful to have |
I agree, since this was a bug, let's just make datetime the default. I like datetimes because they can be |
Wait, why would we want to make datetime the default? Or do you mean the default going forward (going through the usual deprecation cycle)? I've been working around |
Yah, I think making datetime the default in |
There's a PR now, but I am still using origin_as_datetime = False as the default, there's a deprecation warning though. I think it'll be safer to leave it at that for now. We can move over to True in the next version? |
Thanks, this is great! I've played around with it and it mostly does what I would expect. The one area it doesn't is on multi-dimensional triangles. I think it always coerces to a datetime regardless. Consider this unit test: import chainladder as cl
clrd = cl.load_sample('clrd')
def test_origin_as_datetime_arg(clrd):
from pandas.api.types import is_datetime64_any_dtype
assert is_datetime64_any_dtype(clrd).to_frame(origin_as_datetime=True)['origin'])
assert not is_datetime64_any_dtype(clrd).to_frame(origin_as_datetime=False)['origin'])
test_origin_as_datetime_arg(clrd) |
Do you have an extra Anyways, I didn't get an error with this. clrd = cl.load_sample("clrd")
assert is_datetime64_any_dtype(clrd.to_frame(origin_as_datetime=True)["origin"])
assert not is_datetime64_any_dtype(clrd.to_frame(origin_as_datetime=False)["origin"]) With this: clrd.to_frame(origin_as_datetime=False)["origin"] I got |
yes, thanks. At least I wrote it correctly in the unit test. |
Will try to create a new ticket so we can better keep track for patch notes going forward.
Is there a standardized warning message to use? I was thinking
Deprecation warning: in an upcoming version of the package, origin_as_datetime will be defaulted to True in to_frame(...), use origin_as_datetime=False to preserve current setting.
The text was updated successfully, but these errors were encountered: