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

Adjust for pandas 1.2.0 #390

Closed
khaeru opened this issue Dec 27, 2020 · 1 comment · Fixed by #391
Closed

Adjust for pandas 1.2.0 #390

khaeru opened this issue Dec 27, 2020 · 1 comment · Fixed by #391
Assignees
Labels
ci Continuous integration
Milestone

Comments

@khaeru
Copy link
Member

khaeru commented Dec 27, 2020

Changes from pandas 1.1.5 to 1.2.0 (released yesterday) caused the nightly CI workflow to fail; in particular test_timeseries.py::test_get[*-wide], as below. Investigate and fix.

As well, pandas 1.2.0 supports only Python 3.7.1 or later, whereas pandas ≥ 1.0.0 and < 1.2.0 supports Python 3.6.1. Consequently, this test failure doesn't appear on CI workflows using Python 3.6; only those using Python ≥ 3.7. We can probably continue to support Python 3.6 / pandas < 1.2.0 until we are forced to make changes for newer pandas that happen to break support for this older combination.

https://github.com/iiasa/ixmp/runs/1613037680?check_suite_focus=true#step:14:541

__________________________ test_get[Scenario-wide] ____________________________

ts = <ixmp.core.Scenario object at 0x7f726c91bf70>, fmt = 'wide'

    @pytest.mark.parametrize("fmt", ["long", "wide"])
    def test_get(ts, fmt):
        data = DATA[0] if fmt == "long" else wide(DATA[0])
    
        ts.add_timeseries(data)
        ts.commit("")
    
        exp = expected(data, ts)
        args = {}
    
        if fmt == "wide":
            args["iamc"] = True
    
        # Data can be retrieved and has the expected value
        obs = ts.timeseries(**args)
>       assert_frame_equal(exp, obs, check_like=True)

ixmp/tests/core/test_timeseries.py:269: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/site-packages/pandas/core/indexes/base.py:4666: in sort_values
    _as = nargsort(
/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/site-packages/pandas/core/sorting.py:367: in nargsort
    return items.argsort(ascending=ascending, kind=kind, na_position=na_position)
/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/site-packages/pandas/core/arrays/base.py:586: in argsort
    return nargsort(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

items = array(['model', 'scenario', 'region', 'variable', 'unit', 2010, 2020],
      dtype=object)
kind = 'quicksort', ascending = True, na_position = 'last', key = None
mask = array([False, False, False, False, False, False, False])

    def nargsort(
        items,
        kind: str = "quicksort",
        ascending: bool = True,
        na_position: str = "last",
        key: Optional[Callable] = None,
        mask: Optional[np.ndarray] = None,
    ):

[…]

>       indexer = non_nan_idx[non_nans.argsort(kind=kind)]
E       TypeError: '<' not supported between instances of 'int' and 'str'

/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/site-packages/pandas/core/sorting.py:379: TypeError
@khaeru khaeru added the ci Continuous integration label Dec 27, 2020
@khaeru khaeru self-assigned this Jan 4, 2021
@khaeru khaeru added this to the 3.2 milestone Jan 4, 2021
@khaeru
Copy link
Member Author

khaeru commented Jan 14, 2021

The cause is the linked issue pandas-dev/pandas#39168.

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

Successfully merging a pull request may close this issue.

1 participant