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

497 #501

Merged
merged 17 commits into from
Apr 3, 2024
Merged

497 #501

merged 17 commits into from
Apr 3, 2024

Conversation

kennethshsu
Copy link
Collaborator

@kennethshsu
Copy link
Collaborator Author

@jbogaardt, are you familiar with these errors? I looked at it in detail and I don't think I understand what is going on...

=========================== short test summary info ============================
ERROR chainladder/methods/tests/test_predict.py - ValueError: Fancy indexing on origin/development is not supported.
ERROR chainladder/workflow/tests/test_predict.py - ValueError: Fancy indexing on origin/development is not supported.
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!

Is this line causing the error? Why?

@jbogaardt
Copy link
Collaborator

I'm not sure the specifics on the error from this PR, but the error stems from non-contiguous slices out of origin/development.

Here is a bare-bones example that is not supported by the package where we slice an arbitrary list of origins that are out of sequence:

import chainladder as cl
clrd = cl.load_sample('clrd')
clrd.iloc[:, :, [2, 4, 3]]

@kennethshsu
Copy link
Collaborator Author

kennethshsu commented Mar 27, 2024

Hmm... What's weird is that these tests are passing locally... Is there an issue with the way that tests are set up on GitHub?

chainladder/methods/tests/test_predict.py:

% pytest test_predict.py
================================================ test session starts ================================================
platform darwin -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
rootdir: /Users/kennethhsu/Documents/GitHub/chainladder-python
plugins: xdist-2.5.0, cov-4.0.0, forked-1.3.0, anyio-3.7.0
collected 13 items                                                                                                  

test_predict.py .............                                                                                 [100%]

================================================= warnings summary ==================================================
chainladder/methods/tests/test_predict.py::test_misaligned_index[normal_run]
chainladder/methods/tests/test_predict.py::test_misaligned_index[normal_run]
  /Users/kennethhsu/Documents/GitHub/chainladder-python/chainladder/core/base.py:250: UserWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
    arr = dict(zip(datetime_arg, pd.to_datetime(**item)))

chainladder/methods/tests/test_predict.py: 17 warnings
  /Users/kennethhsu/opt/anaconda3/envs/cl_dev/lib/python3.11/site-packages/sparse/_coo/core.py:261: DeprecationWarning: coords should be an ndarray. This will raise a ValueError in the future.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================== 13 passed, 19 warnings in 9.69s ==========================================

Same thing with chainladder/workflow/tests/test_predict.py. Passing locally.

% pytest test_predict.py
================================================ test session starts ================================================
platform darwin -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
rootdir: /Users/kennethhsu/Documents/GitHub/chainladder-python
plugins: xdist-2.5.0, cov-4.0.0, forked-1.3.0, anyio-3.7.0
collected 1 item                                                                                                    

test_predict.py .                                                                                             [100%]

================================================= 1 passed in 0.18s =================================================

@jbogaardt
Copy link
Collaborator

It may be differences in dependencies. Github grabs the latest packages. It is using pandas==2.2.1 .

My suspicion is there are some differences in these versions that is causing it to fail. In issue #494, we have this problem with pandas>2.2.0. I think you just made the same issue visible in our unit tests. I've committed a fix since the pandas team gave a suggestion and also signaled they are unlikely to change the behavior. It seemed to clear those errors, but now has more pointed suggestions for the on-leveling updates.

FAILED chainladder/utils/tests/test_utilities.py::test_non_vertical_line - assert 0.1746221283369899 < 0.0
FAILED chainladder/utils/tests/test_utilities.py::test_vertical_line - UnboundLocalError: cannot access local variable 'cum_avg_rate_non_leaps' where it is not associated with a value

@jbogaardt jbogaardt merged commit 88a2f1c into master Apr 3, 2024
0 of 3 checks passed
@kennethshsu
Copy link
Collaborator Author

@jbogaardt how did you end up fixing the remaining test errors?

=========================== short test summary info ============================
FAILED chainladder/core/tests/test_display.py::test_empty_triangle - AttributeError: 'Triangle' object has no attribute 'values'
FAILED chainladder/core/tests/test_display.py::test_to_frame[normal_run] - ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
FAILED chainladder/core/tests/test_display.py::test_to_frame[sparse_only_run] - ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
===== 3 failed, 603 passed, 11 xfailed, 6055 warnings in 283.53s (0:04:43) =====

I was going to take a look at those. Or are those not resolved yet?

@jbogaardt
Copy link
Collaborator

they aren't resolved, but they are display so I assumed they were related to package dependencies and not the PR itself. Looking closer, I see you have he following in display.py:

        try:
            self.values
        except:
            print("Triangle is empty")
            return

I suspect this is causing it. Can you let me know your intent with this logic?

@kennethshsu
Copy link
Collaborator Author

Ahh, I think that's from another branch to address #491, it's not quite done... I think I messed up my version control while working on the two branches. Let me try to resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants