Are you on the latest chainladder version?
Describe the bug in words
I'm currently working on this, it's a quick fix. The default value to argument value in Triangle.fillna() is None, but trying to call Triangle.fillna() without arguments leads to a TypeError.
How can the bug be reproduced?
import chainladder as cl
clrd = cl.load_sample('clrd')
clrd.fillna()
Traceback (most recent call last):
File "/home/ubuntu/Repos/chainladder-python/.venv/lib/python3.14/site-packages/IPython/core/interactiveshell.py", line 3699, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ipython-input-5-c623c96317f4>", line 1, in <module>
clrd.fillna()
~~~~~~~~~~~^^
File "/home/ubuntu/Repos/chainladder-python/chainladder/core/pandas.py", line 287, in fillna
return new_obj.fillna(value=value, inplace=True)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/Repos/chainladder-python/chainladder/core/pandas.py", line 280, in fillna
frame = self + value * 0
~~~~~~^~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
What is the expected behavior?
I don't think this is something that ever worked, so removing the default argument and making it required will fix the problem without necessitating a major version change. I think we can safely classify this as a bug fix and not an API change.
It should lead to a ValueError, like it does in Pandas:
import pandas as pd
import numpy as np
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, np.nan]})
df.fillna()
Traceback (most recent call last):
File "/home/ubuntu/Repos/chainladder-python/.venv/lib/python3.14/site-packages/IPython/core/interactiveshell.py", line 3699, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ipython-input-7-d3a028362a04>", line 1, in <module>
df.fillna()
~~~~~~~~~^^
File "/home/ubuntu/Repos/chainladder-python/.venv/lib/python3.14/site-packages/pandas/core/generic.py", line 7316, in fillna
value, method = validate_fillna_kwargs(value, method)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/home/ubuntu/Repos/chainladder-python/.venv/lib/python3.14/site-packages/pandas/util/_validators.py", line 293, in validate_fillna_kwargs
raise ValueError("Must specify a fill 'value' or 'method'.")
ValueError: Must specify a fill 'value' or 'method'.
There's no exception handling in this method, so it should be added.
Would you be willing to contribute this ticket?
Are you on the latest chainladder version?
Describe the bug in words
I'm currently working on this, it's a quick fix. The default value to argument
valueinTriangle.fillna()is None, but trying to callTriangle.fillna()without arguments leads to a TypeError.How can the bug be reproduced?
What is the expected behavior?
I don't think this is something that ever worked, so removing the default argument and making it required will fix the problem without necessitating a major version change. I think we can safely classify this as a bug fix and not an API change.
It should lead to a ValueError, like it does in Pandas:
There's no exception handling in this method, so it should be added.
Would you be willing to contribute this ticket?