Skip to content

Adjust for pandas 1.2.0 #390

Closed
Closed
@khaeru

Description

@khaeru

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

Activity

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

Metadata

Metadata

Assignees

Labels

ciContinuous integration

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions